forked from p15670423/monkey
Changed cmds from array to dict
This commit is contained in:
parent
908c531696
commit
6636cd23e8
|
@ -25,7 +25,7 @@ class HostExploiter(object):
|
|||
'finished': '',
|
||||
'vulnerable_urls': [],
|
||||
'vulnerable_ports': [],
|
||||
'executed_cmds': []}
|
||||
'executed_cmds': {}}
|
||||
self._exploit_attempts = []
|
||||
self.host = host
|
||||
|
||||
|
@ -59,6 +59,9 @@ class HostExploiter(object):
|
|||
def add_vuln_port(self, port):
|
||||
self._exploit_info['vulnerable_ports'].append(port)
|
||||
|
||||
def add_example_cmd(self, cmd):
|
||||
self._exploit_info['executed_cmds']['example'] = cmd
|
||||
|
||||
|
||||
from infection_monkey.exploit.win_ms08_067 import Ms08_067_Exploiter
|
||||
from infection_monkey.exploit.wmiexec import WmiExploiter
|
||||
|
|
|
@ -49,7 +49,7 @@ class HadoopExploiter(WebRCE):
|
|||
return False
|
||||
http_thread.join(self.DOWNLOAD_TIMEOUT)
|
||||
http_thread.stop()
|
||||
self._exploit_info['executed_cmds'].append(command)
|
||||
self.add_example_cmd(command)
|
||||
return True
|
||||
|
||||
def exploit(self, url, command):
|
||||
|
|
|
@ -76,7 +76,7 @@ class MSSQLExploiter(HostExploiter):
|
|||
commands.extend(monkey_args)
|
||||
MSSQLExploiter.execute_command(cursor, commands)
|
||||
MSSQLExploiter.run_file(cursor, tmp_file_path)
|
||||
self._exploit_info['executed_cmds'].append(commands[-1])
|
||||
self.add_example_cmd(commands[-1])
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -343,5 +343,5 @@ class RdpExploiter(HostExploiter):
|
|||
|
||||
LOG.info("Executed monkey '%s' on remote victim %r",
|
||||
os.path.basename(src_path), self.host)
|
||||
self._exploit_info['executed_cmds'].append(command)
|
||||
self.add_example_cmd(command)
|
||||
return True
|
||||
|
|
|
@ -144,7 +144,7 @@ class ShellShockExploiter(HostExploiter):
|
|||
if not (self.check_remote_file_exists(url, header, exploit, self._config.monkey_log_path_linux)):
|
||||
LOG.info("Log file does not exist, monkey might not have run")
|
||||
continue
|
||||
self._exploit_info['executed_cmds'].append(cmdline)
|
||||
self.add_example_cmd(cmdline)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
|
@ -178,7 +178,7 @@ class SSHExploiter(HostExploiter):
|
|||
self._config.dropper_target_path_linux, self.host, cmdline)
|
||||
|
||||
ssh.close()
|
||||
self._exploit_info['executed_cmds'].append(cmdline)
|
||||
self.add_example_cmd(cmdline)
|
||||
return True
|
||||
|
||||
except Exception as exc:
|
||||
|
|
|
@ -138,7 +138,7 @@ class VSFTPDExploiter(HostExploiter):
|
|||
if backdoor_socket.send(run_monkey):
|
||||
LOG.info("Executed monkey '%s' on remote victim %r (cmdline=%r)", self._config.dropper_target_path_linux,
|
||||
self.host, run_monkey)
|
||||
self._exploit_info['executed_cmds'].append(run_monkey)
|
||||
self.add_example_cmd(run_monkey)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
|
@ -420,7 +420,7 @@ class WebRCE(HostExploiter):
|
|||
return False
|
||||
LOG.info("Execution attempt finished")
|
||||
|
||||
self._exploit_info['executed_cmds'].append(command)
|
||||
self.add_example_cmd(command)
|
||||
return resp
|
||||
|
||||
def get_monkey_upload_path(self, url_to_monkey):
|
||||
|
|
|
@ -114,7 +114,7 @@ class WmiExploiter(HostExploiter):
|
|||
|
||||
result.RemRelease()
|
||||
wmi_connection.close()
|
||||
|
||||
self.add_example_cmd(cmdline)
|
||||
return success
|
||||
|
||||
return False
|
||||
|
|
|
@ -13,7 +13,7 @@ class T1059(AttackTechnique):
|
|||
used_msg = "Monkey successfully ran commands on exploited machines in the network."
|
||||
|
||||
query = [{'$match': {'telem_type': 'exploit',
|
||||
'data.info.executed_cmds': {'$not': {'$size': 0}}}},
|
||||
'data.info.executed_cmds.example': {'$exists': True}}},
|
||||
{'$project': {'_id': 0,
|
||||
'machine': '$data.machine',
|
||||
'info': '$data.info'}},
|
||||
|
|
|
@ -15,7 +15,7 @@ class T1059 extends React.Component {
|
|||
columns: [
|
||||
{Header: 'Machine', id: 'machine', accessor: x => RenderMachine(x.data[0].machine), style: { 'whiteSpace': 'unset'}, width: 160 },
|
||||
{Header: 'Approx. Time', id: 'time', accessor: x => x.data[0].info.finished, style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds[0], style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds.example, style: { 'whiteSpace': 'unset' }},
|
||||
]
|
||||
}])};
|
||||
|
||||
|
|
Loading…
Reference in New Issue