Added parameter logging on monkey start, fixed bug where dropper launched monkey inproperly

This commit is contained in:
VakarisZ 2020-05-21 19:23:23 +03:00
parent 30be271598
commit 436472b578
2 changed files with 11 additions and 5 deletions

View File

@ -116,11 +116,12 @@ class MonkeyDrops(object):
LOG.warning("Cannot set reference date to destination file")
monkey_options = \
build_monkey_commandline_explicitly(self.opts.parent,
self.opts.tunnel,
self.opts.server,
self.opts.depth,
self.opts.vulnerable_port)
build_monkey_commandline_explicitly(parent=self.opts.parent,
tunnel=self.opts.tunnel,
server=self.opts.server,
depth=self.opts.depth,
location=None,
vulnerable_port=self.opts.vulnerable_port)
if OperatingSystem.Windows == SystemInfoCollector.get_os():
monkey_cmdline = MONKEY_CMDLINE_WINDOWS % {'monkey_path': self._config['destination_path']} + monkey_options

View File

@ -74,6 +74,7 @@ class InfectionMonkey(object):
arg_parser.add_argument('-d', '--depth', type=int)
arg_parser.add_argument('-vp', '--vulnerable-port')
self._opts, self._args = arg_parser.parse_known_args(self._args)
self.log_arguments()
self._parent = self._opts.parent
self._default_tunnel = self._opts.tunnel
@ -387,3 +388,7 @@ class InfectionMonkey(object):
def is_started_on_island(self):
island_ip = remove_port_from_ip_string(self._default_server)
return is_running_on_server(island_ip) and WormConfiguration.depth == WormConfiguration.max_depth
def log_arguments(self):
arg_string = " ".join([f"{key}: {value}" for key, value in vars(self._opts).items()])
LOG.info(f"Monkey started with arguments: {arg_string}")