diff --git a/monkey_island/cc/island_config.py b/monkey_island/cc/island_config.py index c53d27004..0a8f33bac 100644 --- a/monkey_island/cc/island_config.py +++ b/monkey_island/cc/island_config.py @@ -1,4 +1,5 @@ __author__ = 'itay.mizeretz' ISLAND_PORT = 5000 -DEFAULT_MONGO_URL = "mongodb://localhost:27017/monkeyisland" \ No newline at end of file +DEFAULT_MONGO_URL = "mongodb://localhost:27017/monkeyisland" +DEBUG_SERVER = False diff --git a/monkey_island/cc/main.py b/monkey_island/cc/main.py index dd133cfd1..68fae4e72 100644 --- a/monkey_island/cc/main.py +++ b/monkey_island/cc/main.py @@ -9,7 +9,7 @@ if BASE_PATH not in sys.path: from cc.app import init_app from cc.utils import local_ip_addresses -from cc.island_config import DEFAULT_MONGO_URL, ISLAND_PORT +from cc.island_config import DEFAULT_MONGO_URL, ISLAND_PORT, DEBUG_SERVER if __name__ == '__main__': from tornado.wsgi import WSGIContainer @@ -17,10 +17,14 @@ if __name__ == '__main__': from tornado.ioloop import IOLoop app = init_app(os.environ.get('MONGO_URL', DEFAULT_MONGO_URL)) - http_server = HTTPServer(WSGIContainer(app), - ssl_options={'certfile': os.environ.get('SERVER_CRT', 'server.crt'), - 'keyfile': os.environ.get('SERVER_KEY', 'server.key')}) - http_server.listen(ISLAND_PORT) - print('Monkey Island C&C Server is running on https://{}:{}'.format(local_ip_addresses()[0], ISLAND_PORT)) - IOLoop.instance().start() - # app.run(host='0.0.0.0', debug=True, ssl_context=('server.crt', 'server.key')) + + if DEBUG_SERVER: + app.run(host='0.0.0.0', debug=True, ssl_context=('server.crt', 'server.key')) + else: + http_server = HTTPServer(WSGIContainer(app), + ssl_options={'certfile': os.environ.get('SERVER_CRT', 'server.crt'), + 'keyfile': os.environ.get('SERVER_KEY', 'server.key')}) + http_server.listen(ISLAND_PORT) + print('Monkey Island C&C Server is running on https://{}:{}'.format(local_ip_addresses()[0], ISLAND_PORT)) + IOLoop.instance().start() +