forked from p15670423/monkey
powershell command storage refactor
This commit is contained in:
parent
17d08c7883
commit
c4c53f732a
|
@ -60,7 +60,8 @@ class HostExploiter(object):
|
||||||
self._exploit_info['vulnerable_ports'].append(port)
|
self._exploit_info['vulnerable_ports'].append(port)
|
||||||
|
|
||||||
def set_example_cmd(self, cmd):
|
def set_example_cmd(self, cmd):
|
||||||
self._exploit_info['executed_cmds']['example'] = cmd
|
powershell = True if "powershell" in cmd.lower() else False
|
||||||
|
self._exploit_info['executed_cmds']['example'].append({'command': cmd, 'powershell': powershell})
|
||||||
|
|
||||||
def add_powershell_cmd(self, cmd):
|
def add_powershell_cmd(self, cmd):
|
||||||
"""
|
"""
|
||||||
|
@ -68,8 +69,6 @@ class HostExploiter(object):
|
||||||
:param cmd: Command used
|
:param cmd: Command used
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
if "powershell" in cmd.lower():
|
|
||||||
self._exploit_info['executed_cmds']['powershell'] = cmd
|
|
||||||
|
|
||||||
|
|
||||||
from infection_monkey.exploit.win_ms08_067 import Ms08_067_Exploiter
|
from infection_monkey.exploit.win_ms08_067 import Ms08_067_Exploiter
|
||||||
|
|
|
@ -13,7 +13,7 @@ class T1086(AttackTechnique):
|
||||||
used_msg = "Monkey successfully ran powershell commands on exploited machines in the network."
|
used_msg = "Monkey successfully ran powershell commands on exploited machines in the network."
|
||||||
|
|
||||||
query = [{'$match': {'telem_type': 'exploit',
|
query = [{'$match': {'telem_type': 'exploit',
|
||||||
'data.info.executed_cmds.powershell': {'$exists': True}}},
|
'data.info.executed_cmds.example': {'$elemMatch': {'powershell': True}}}},
|
||||||
{'$project': {'_id': 0,
|
{'$project': {'_id': 0,
|
||||||
'machine': '$data.machine',
|
'machine': '$data.machine',
|
||||||
'info': '$data.info'}},
|
'info': '$data.info'}},
|
||||||
|
@ -22,9 +22,10 @@ class T1086(AttackTechnique):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_report_data():
|
def get_report_data():
|
||||||
cmd_data = list(mongo.db.telemetry.aggregate(T1086.query))
|
cmd_data = list(mongo.db.telemetry.aggregate(T1086.query))
|
||||||
data = {'title': T1086.technique_title(T1086.tech_id), 'cmds': cmd_data}
|
data = {'title': T1086.technique_title(), 'cmds': cmd_data}
|
||||||
if cmd_data:
|
if cmd_data:
|
||||||
data.update({'message': T1086.used_msg, 'status': ScanStatus.USED.name})
|
status = ScanStatus.USED
|
||||||
else:
|
else:
|
||||||
data.update({'message': T1086.unscanned_msg, 'status': ScanStatus.UNSCANNED.name})
|
status = ScanStatus.UNSCANNED
|
||||||
|
data.update(T1086.get_message_and_status(status))
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Reference in New Issue