From 36230fa25cb4015d398d56d7b3f1ca14b3994091 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Wed, 13 Jun 2018 15:40:13 +0300 Subject: [PATCH] monkey island can now be run from both monkey_island.py and run_cc.bat --- monkey/monkey_island.py | 4 ++++ monkey/monkey_island/cc/main.py | 6 +++++- monkey/monkey_island/windows/run_cc.bat | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 monkey/monkey_island.py diff --git a/monkey/monkey_island.py b/monkey/monkey_island.py new file mode 100644 index 000000000..104b5efdf --- /dev/null +++ b/monkey/monkey_island.py @@ -0,0 +1,4 @@ +import monkey_island.cc.main + +if "__main__" == __name__: + monkey_island.cc.main.main() diff --git a/monkey/monkey_island/cc/main.py b/monkey/monkey_island/cc/main.py index 722009aa9..b23fd4cf7 100644 --- a/monkey/monkey_island/cc/main.py +++ b/monkey/monkey_island/cc/main.py @@ -14,7 +14,8 @@ from cc.utils import local_ip_addresses from cc.environment.environment import env from cc.database import is_db_server_up -if __name__ == '__main__': + +def main(): from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop @@ -36,3 +37,6 @@ if __name__ == '__main__': print('Monkey Island Server is running on https://{}:{}'.format(local_ip_addresses()[0], env.get_island_port())) IOLoop.instance().start() + +if __name__ == '__main__': + main() diff --git a/monkey/monkey_island/windows/run_cc.bat b/monkey/monkey_island/windows/run_cc.bat index 56f349c7b..e86b5a145 100644 --- a/monkey/monkey_island/windows/run_cc.bat +++ b/monkey/monkey_island/windows/run_cc.bat @@ -1,4 +1,4 @@ @title C^&C Server @pushd .. -@monkey_island\bin\Python27\python monkey_island\cc\main.py +@monkey_island\bin\Python27\python monkey_island.py @popd \ No newline at end of file