Small refactor, values to island's config added.
This commit is contained in:
parent
eb1cb91704
commit
d61c080848
|
@ -219,7 +219,6 @@ class InfectionMonkey(object):
|
|||
self._singleton.unlock()
|
||||
|
||||
InfectionMonkey.self_delete()
|
||||
utils.remove_monkey_dir()
|
||||
LOG.info("Monkey is shutting down")
|
||||
|
||||
@staticmethod
|
||||
|
@ -234,6 +233,7 @@ class InfectionMonkey(object):
|
|||
if WormConfiguration.self_delete_in_cleanup \
|
||||
and -1 == sys.executable.find('python'):
|
||||
try:
|
||||
utils.remove_monkey_dir()
|
||||
if "win32" == sys.platform:
|
||||
from _subprocess import SW_HIDE, STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
|
|
|
@ -42,19 +42,19 @@ def create_monkey_dir():
|
|||
"""
|
||||
Creates directory for monkey and related files
|
||||
"""
|
||||
if is_windows_os():
|
||||
if not os.path.exists(WormConfiguration.monkey_dir_windows):
|
||||
os.mkdir(WormConfiguration.monkey_dir_windows)
|
||||
else:
|
||||
if not os.path.exists(WormConfiguration.monkey_log_path_linux):
|
||||
os.mkdir(WormConfiguration.monkey_dir_linux)
|
||||
if not os.path.exists(get_monkey_dir_path()):
|
||||
os.mkdir(get_monkey_dir_path())
|
||||
|
||||
|
||||
def remove_monkey_dir():
|
||||
"""
|
||||
Removes monkey's root directory
|
||||
"""
|
||||
shutil.rmtree(get_monkey_dir_path(), ignore_errors=True)
|
||||
|
||||
|
||||
def get_monkey_dir_path():
|
||||
if is_windows_os():
|
||||
shutil.rmtree(WormConfiguration.monkey_dir_windows, ignore_errors=True)
|
||||
return WormConfiguration.monkey_dir_windows
|
||||
else:
|
||||
shutil.rmtree(WormConfiguration.monkey_dir_linux, ignore_errors=True)
|
||||
return WormConfiguration.monkey_dir_linux
|
||||
|
|
|
@ -423,7 +423,19 @@ SCHEMA = {
|
|||
"type": "integer",
|
||||
"default": 60,
|
||||
"description": "Time to keep tunnel open before going down after last exploit (in seconds)"
|
||||
}
|
||||
},
|
||||
"monkey_dir_windows": {
|
||||
"title": "Monkey's windows directory",
|
||||
"type": "string",
|
||||
"default": r"C:\Windows\temp\monkey_dir",
|
||||
"description": "Directory containing all monkey files on windows"
|
||||
},
|
||||
"monkey_dir_linux": {
|
||||
"title": "Monkey's linux directory",
|
||||
"type": "string",
|
||||
"default": "/tmp/monkey_dir",
|
||||
"description": "Directory containing all monkey files on linux"
|
||||
},
|
||||
}
|
||||
},
|
||||
"classes": {
|
||||
|
|
Loading…
Reference in New Issue