Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-Registration config #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ api/uploads/*
api/logs/*
gui/guienv/*
*.pyc
.DS_Store
api/uploads/*
**/.DS_Store
**/config.yaml
env
40 changes: 21 additions & 19 deletions api/apiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,30 +656,32 @@ def delete( self ):
})

def make_app():
return tornado.web.Application([
(r"/api/register", RegisterHandler),
(r"/api/login", LoginHandler),
(r"/api/collected_pages", GetCollectedPagesHandler),
(r"/api/delete_injection", DeleteInjectionHandler),
(r"/api/delete_collected_page", DeleteCollectedPageHandler),
(r"/api/user", UserInformationHandler),
(r"/api/payloadfires", GetXSSPayloadFiresHandler),
(r"/api/contactus", ContactUsHandler),
(r"/api/resend_injection_email", ResendInjectionEmailHandler),
(r"/api/logout", LogoutHandler),
(r"/js_callback", CallbackHandler),
(r"/page_callback", CollectPageHandler),
(r"/health", HealthHandler),
(r"/uploads/(.*)", tornado.web.StaticFileHandler, {"path": "uploads/"}),
(r"/api/record_injection", InjectionRequestHandler),
(r"/(.*)", HomepageHandler),
], cookie_secret=settings["cookie_secret"])
app_routes = [
(r"/api/register", RegisterHandler),
(r"/api/login", LoginHandler),
(r"/api/collected_pages", GetCollectedPagesHandler),
(r"/api/delete_injection", DeleteInjectionHandler),
(r"/api/delete_collected_page", DeleteCollectedPageHandler),
(r"/api/user", UserInformationHandler),
(r"/api/payloadfires", GetXSSPayloadFiresHandler),
(r"/api/contactus", ContactUsHandler),
(r"/api/resend_injection_email", ResendInjectionEmailHandler),
(r"/api/logout", LogoutHandler),
(r"/js_callback", CallbackHandler),
(r"/page_callback", CollectPageHandler),
(r"/health", HealthHandler),
(r"/uploads/(.*)", tornado.web.StaticFileHandler, {"path": "uploads/"}),
(r"/api/record_injection", InjectionRequestHandler),
(r"/(.*)", HomepageHandler)]
if not settings['self_registration']:
app_routes.remove((r"/api/register", RegisterHandler))
return tornado.web.Application(app_routes, cookie_secret=settings["cookie_secret"])

if __name__ == "__main__":
args = sys.argv
args.append("--log_file_prefix=logs/access.log")
tornado.options.parse_command_line(args)
Base.metadata.create_all(engine)
app = make_app()
app.listen( 8888 )
app.listen( 8888, "localhost")
tornado.ioloop.IOLoop.current().start()
4 changes: 4 additions & 0 deletions generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"domain": "",
"abuse_email": "",
"cookie_secret": "",
"self_registration": "yes",
}

print """
Expand Down Expand Up @@ -173,6 +174,9 @@
/etc/nginx/ssl/""" + hostname + """.crt; # Wildcard SSL certificate
/etc/nginx/ssl/""" + hostname + """.key; # Wildcard SSL key

Note: by default self-registration is enabled. You can disable this by changing the 'self_registration' option in the config file to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about this, wouldn't setting this to a no still make it enabled? no is a string which should be True-ish in Python right: if not settings['self_registration']:. Let me know if I'm missing something!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would have thought so too, but it seems to work just fine. Yaml is a bit weird (I've never used it before personally), and I think PyYAML converts "yes/no" into Booleans (see https://stackoverflow.com/questions/36463531/pyyaml-automatically-converting-certain-keys-to-boolean-values).

Copy link
Author

@swarley7 swarley7 Aug 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work :P
¯\_(ツ)_/¯

"no".

Good luck hunting for XSS!
-mandatory
"""
21 changes: 12 additions & 9 deletions gui/guiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,21 @@ def get(self):
self.write( loader.load( "contact.htm" ).generate() )

def make_app():
return tornado.web.Application([
(r"/", HomepageHandler),
(r"/app", XSSHunterApplicationHandler),
(r"/features", FeaturesHandler),
(r"/signup", SignUpHandler),
(r"/contact", ContactHandler),
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "static/"}),
])
app_routes = [
(r"/", HomepageHandler),
(r"/app", XSSHunterApplicationHandler),
(r"/features", FeaturesHandler),
(r"/contact", ContactHandler),
(r"/signup", SignUpHandler),
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "static/"})
]
if not settings['self_registration']:
app_routes.remove((r"/signup", SignUpHandler))
return tornado.web.Application(app_routes)

if __name__ == "__main__":
DOMAIN = settings["domain"]
API_SERVER = "https://api." + DOMAIN
app = make_app()
app.listen( 1234 )
app.listen( 1234, "localhost")
tornado.ioloop.IOLoop.current().start()