forked from p15670423/monkey
Refactored monkey island startup files to the old structure which was compatible with our build scripts.
This commit is contained in:
parent
e6bb48100e
commit
cc00b85edc
|
@ -1,32 +1,4 @@
|
|||
# This import patches other imports and needs to be first
|
||||
import monkey_island.setup.gevent_setup # noqa: F401 isort:skip
|
||||
|
||||
import json
|
||||
|
||||
from monkey_island.cc.arg_parser import parse_cli_args
|
||||
from monkey_island.cc.server_setup import setup_island
|
||||
from monkey_island.cc.server_utils.island_logger import setup_logging
|
||||
from monkey_island.setup.config_setup import setup_config_by_cmd_arg, setup_default_config
|
||||
from monkey_island.startup import start_island
|
||||
|
||||
if "__main__" == __name__:
|
||||
island_args = parse_cli_args()
|
||||
|
||||
# This is here in order to catch EVERYTHING, some functions are being called on
|
||||
# imports, so the log init needs to be first.
|
||||
try:
|
||||
if island_args.server_config_path:
|
||||
config, server_config_path = setup_config_by_cmd_arg(island_args.server_config_path)
|
||||
else:
|
||||
config, server_config_path = setup_default_config()
|
||||
|
||||
setup_logging(config.data_dir, config.log_level)
|
||||
|
||||
except OSError as ex:
|
||||
print(f"Error opening server config file: {ex}")
|
||||
exit(1)
|
||||
|
||||
except json.JSONDecodeError as ex:
|
||||
print(f"Error loading server config: {ex}")
|
||||
exit(1)
|
||||
|
||||
setup_island(island_args.setup_only, config, server_config_path)
|
||||
start_island()
|
||||
|
|
|
@ -16,7 +16,7 @@ def main():
|
|||
("../monkey_island/cc/services/attack/attack_data", "/monkey_island/cc/services/attack/attack_data")
|
||||
]
|
||||
|
||||
a = Analysis(['cc/main.py'],
|
||||
a = Analysis(['startup.py'],
|
||||
pathex=['..'],
|
||||
hiddenimports=get_hidden_imports(),
|
||||
hookspath=[os.path.join(".", "pyinstaller_hooks")],
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# This import patches other imports and needs to be first
|
||||
import monkey_island.setup.gevent_setup # noqa: F401 isort:skip
|
||||
|
||||
import json
|
||||
|
||||
from monkey_island.cc.arg_parser import parse_cli_args
|
||||
from monkey_island.cc.server_setup import setup_island
|
||||
from monkey_island.cc.server_utils.island_logger import setup_logging
|
||||
from monkey_island.setup.config_setup import setup_config_by_cmd_arg, setup_default_config
|
||||
|
||||
|
||||
def start_island():
|
||||
island_args = parse_cli_args()
|
||||
|
||||
# This is here in order to catch EVERYTHING, some functions are being called on
|
||||
# imports, so the log init needs to be first.
|
||||
try:
|
||||
if island_args.server_config_path:
|
||||
config, server_config_path = setup_config_by_cmd_arg(island_args.server_config_path)
|
||||
else:
|
||||
config, server_config_path = setup_default_config()
|
||||
|
||||
setup_logging(config.data_dir, config.log_level)
|
||||
|
||||
except OSError as ex:
|
||||
print(f"Error opening server config file: {ex}")
|
||||
exit(1)
|
||||
|
||||
except json.JSONDecodeError as ex:
|
||||
print(f"Error loading server config: {ex}")
|
||||
exit(1)
|
||||
|
||||
setup_island(island_args.setup_only, config, server_config_path)
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
start_island()
|
Loading…
Reference in New Issue