forked from p34709852/monkey
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()
|
self._singleton.unlock()
|
||||||
|
|
||||||
InfectionMonkey.self_delete()
|
InfectionMonkey.self_delete()
|
||||||
utils.remove_monkey_dir()
|
|
||||||
LOG.info("Monkey is shutting down")
|
LOG.info("Monkey is shutting down")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -234,6 +233,7 @@ class InfectionMonkey(object):
|
||||||
if WormConfiguration.self_delete_in_cleanup \
|
if WormConfiguration.self_delete_in_cleanup \
|
||||||
and -1 == sys.executable.find('python'):
|
and -1 == sys.executable.find('python'):
|
||||||
try:
|
try:
|
||||||
|
utils.remove_monkey_dir()
|
||||||
if "win32" == sys.platform:
|
if "win32" == sys.platform:
|
||||||
from _subprocess import SW_HIDE, STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE
|
from _subprocess import SW_HIDE, STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
|
|
@ -42,19 +42,19 @@ def create_monkey_dir():
|
||||||
"""
|
"""
|
||||||
Creates directory for monkey and related files
|
Creates directory for monkey and related files
|
||||||
"""
|
"""
|
||||||
if is_windows_os():
|
if not os.path.exists(get_monkey_dir_path()):
|
||||||
if not os.path.exists(WormConfiguration.monkey_dir_windows):
|
os.mkdir(get_monkey_dir_path())
|
||||||
os.mkdir(WormConfiguration.monkey_dir_windows)
|
|
||||||
else:
|
|
||||||
if not os.path.exists(WormConfiguration.monkey_log_path_linux):
|
|
||||||
os.mkdir(WormConfiguration.monkey_dir_linux)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_monkey_dir():
|
def remove_monkey_dir():
|
||||||
"""
|
"""
|
||||||
Removes monkey's root directory
|
Removes monkey's root directory
|
||||||
"""
|
"""
|
||||||
|
shutil.rmtree(get_monkey_dir_path(), ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
def get_monkey_dir_path():
|
||||||
if is_windows_os():
|
if is_windows_os():
|
||||||
shutil.rmtree(WormConfiguration.monkey_dir_windows, ignore_errors=True)
|
return WormConfiguration.monkey_dir_windows
|
||||||
else:
|
else:
|
||||||
shutil.rmtree(WormConfiguration.monkey_dir_linux, ignore_errors=True)
|
return WormConfiguration.monkey_dir_linux
|
||||||
|
|
|
@ -423,7 +423,19 @@ SCHEMA = {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default": 60,
|
"default": 60,
|
||||||
"description": "Time to keep tunnel open before going down after last exploit (in seconds)"
|
"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": {
|
"classes": {
|
||||||
|
|
Loading…
Reference in New Issue