Bugfix when upgrading the monkey without admin permissions.

Can happen during development or future exploit flows
This commit is contained in:
Daniel Goldberg 2018-04-17 11:27:35 +03:00
parent c82fd3400a
commit 3fe6d2456b
1 changed files with 8 additions and 4 deletions

View File

@ -32,10 +32,14 @@ class WindowsUpgrader(object):
@staticmethod @staticmethod
def upgrade(opts): def upgrade(opts):
try:
monkey_64_path = ControlClient.download_monkey_exe_by_os(True, False) monkey_64_path = ControlClient.download_monkey_exe_by_os(True, False)
with monkeyfs.open(monkey_64_path, "rb") as downloaded_monkey_file: with monkeyfs.open(monkey_64_path, "rb") as downloaded_monkey_file:
with open(WormConfiguration.dropper_target_path_win_64, 'wb') as written_monkey_file: with open(WormConfiguration.dropper_target_path_win_64, 'wb') as written_monkey_file:
shutil.copyfileobj(downloaded_monkey_file, written_monkey_file) shutil.copyfileobj(downloaded_monkey_file, written_monkey_file)
except (IOError, AttributeError):
LOG.error("Failed to download the Monkey to the target path.")
return
monkey_options = build_monkey_commandline_explicitly(opts.parent, opts.tunnel, opts.server, opts.depth) monkey_options = build_monkey_commandline_explicitly(opts.parent, opts.tunnel, opts.server, opts.depth)