Agent: Always use file logging
This commit is contained in:
parent
5f4a762cad
commit
8affca8490
|
@ -77,7 +77,6 @@ class Configuration(object):
|
||||||
# logging config
|
# logging config
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
use_file_logging = True
|
|
||||||
dropper_log_path_windows = "%temp%\\~df1562.tmp"
|
dropper_log_path_windows = "%temp%\\~df1562.tmp"
|
||||||
dropper_log_path_linux = "/tmp/user-1562"
|
dropper_log_path_linux = "/tmp/user-1562"
|
||||||
monkey_log_path_windows = "%temp%\\~df1563.tmp"
|
monkey_log_path_windows = "%temp%\\~df1563.tmp"
|
||||||
|
|
|
@ -83,7 +83,6 @@
|
||||||
8088
|
8088
|
||||||
],
|
],
|
||||||
"timeout_between_iterations": 10,
|
"timeout_between_iterations": 10,
|
||||||
"use_file_logging": true,
|
|
||||||
"victims_max_exploit": 100,
|
"victims_max_exploit": 100,
|
||||||
"victims_max_find": 100,
|
"victims_max_find": 100,
|
||||||
"post_breach_actions": []
|
"post_breach_actions": []
|
||||||
|
|
|
@ -90,20 +90,17 @@ def main():
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if WormConfiguration.use_file_logging:
|
if os.path.exists(log_path):
|
||||||
if os.path.exists(log_path):
|
# If log exists but can't be removed it means other monkey is running. This usually
|
||||||
# If log exists but can't be removed it means other monkey is running. This usually
|
# happens on upgrade
|
||||||
# happens on upgrade
|
# from 32bit to 64bit monkey on Windows. In all cases this shouldn't be a problem.
|
||||||
# from 32bit to 64bit monkey on Windows. In all cases this shouldn't be a problem.
|
try:
|
||||||
try:
|
os.remove(log_path)
|
||||||
os.remove(log_path)
|
except OSError:
|
||||||
except OSError:
|
pass
|
||||||
pass
|
LOG_CONFIG["handlers"]["file"]["filename"] = log_path
|
||||||
LOG_CONFIG["handlers"]["file"]["filename"] = log_path
|
# noinspection PyUnresolvedReferences
|
||||||
# noinspection PyUnresolvedReferences
|
LOG_CONFIG["root"]["handlers"].append("file")
|
||||||
LOG_CONFIG["root"]["handlers"].append("file")
|
|
||||||
else:
|
|
||||||
del LOG_CONFIG["handlers"]["file"]
|
|
||||||
|
|
||||||
logging.config.dictConfig(LOG_CONFIG)
|
logging.config.dictConfig(LOG_CONFIG)
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
Loading…
Reference in New Issue