run black to format monkey_island.py
This commit is contained in:
parent
e8bb2e6be2
commit
8b3703816d
|
@ -5,25 +5,40 @@ gevent_monkey.patch_all()
|
||||||
import json # noqa: E402
|
import json # noqa: E402
|
||||||
|
|
||||||
from monkey_island.cc.main import main # noqa: E402
|
from monkey_island.cc.main import main # noqa: E402
|
||||||
from monkey_island.cc.consts import DEFAULT_SERVER_CONFIG_PATH, DEFAULT_LOGGING_CONFIG_PATH # noqa: E402
|
from monkey_island.cc.consts import (
|
||||||
|
DEFAULT_SERVER_CONFIG_PATH,
|
||||||
|
DEFAULT_LOGGING_CONFIG_PATH,
|
||||||
|
) # noqa: E402
|
||||||
from monkey_island.cc.island_logger import json_setup_logging # noqa: E402
|
from monkey_island.cc.island_logger import json_setup_logging # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def parse_cli_args():
|
def parse_cli_args():
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Infection Monkey Island CnC Server. See https://infectionmonkey.com",
|
parser = argparse.ArgumentParser(
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
description="Infection Monkey Island CnC Server. See https://infectionmonkey.com",
|
||||||
parser.add_argument("-s", "--setup-only", action="store_true",
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-s",
|
||||||
|
"--setup-only",
|
||||||
|
action="store_true",
|
||||||
help="Pass this flag to cause the Island to setup and exit without actually starting. "
|
help="Pass this flag to cause the Island to setup and exit without actually starting. "
|
||||||
"This is useful for preparing Island to boot faster later-on, so for "
|
"This is useful for preparing Island to boot faster later-on, so for "
|
||||||
"compiling/packaging Islands.")
|
"compiling/packaging Islands.",
|
||||||
parser.add_argument("--server-config", action="store",
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--server-config",
|
||||||
|
action="store",
|
||||||
help="The path to the server configuration file.",
|
help="The path to the server configuration file.",
|
||||||
default=DEFAULT_SERVER_CONFIG_PATH)
|
default=DEFAULT_SERVER_CONFIG_PATH,
|
||||||
parser.add_argument("--logging-config", action="store",
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--logging-config",
|
||||||
|
action="store",
|
||||||
help="The path to the logging configuration file.",
|
help="The path to the logging configuration file.",
|
||||||
default=DEFAULT_LOGGING_CONFIG_PATH)
|
default=DEFAULT_LOGGING_CONFIG_PATH,
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
return (args.setup_only, args.server_config, args.logging_config)
|
return (args.setup_only, args.server_config, args.logging_config)
|
||||||
|
@ -36,9 +51,10 @@ if "__main__" == __name__:
|
||||||
# imports, so the log init needs to be first.
|
# imports, so the log init needs to be first.
|
||||||
try:
|
try:
|
||||||
json_setup_logging(logging_config)
|
json_setup_logging(logging_config)
|
||||||
except(json.JSONDecodeError) as ex:
|
except (json.JSONDecodeError) as ex:
|
||||||
print(f"Error loading logging config: {ex}")
|
print(f"Error loading logging config: {ex}")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
from monkey_island.cc.main import main
|
from monkey_island.cc.main import main
|
||||||
|
|
||||||
main(is_setup_only, server_config)
|
main(is_setup_only, server_config)
|
||||||
|
|
Loading…
Reference in New Issue