forked from p34709852/monkey
Added simple telemetry feed
This commit is contained in:
parent
f35340e7ae
commit
308a1e3547
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
from infection_monkey.control import ControlClient
|
||||
import subprocess
|
||||
import socket
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -20,9 +21,13 @@ class PBA(object):
|
|||
command = self.windows_command
|
||||
exec_funct = self.execute_win
|
||||
if command:
|
||||
hostname = socket.gethostname()
|
||||
ControlClient.send_telemetry('post_breach', {'command': command,
|
||||
'output': exec_funct(),
|
||||
'name': self.name})
|
||||
'name': self.name,
|
||||
'hostname': hostname,
|
||||
'ip': socket.gethostbyname(hostname)
|
||||
})
|
||||
|
||||
def execute_linux(self):
|
||||
# Default linux PBA execution function. Override if additional functionality is needed
|
||||
|
|
|
@ -34,7 +34,7 @@ class PostBreach(object):
|
|||
def get_custom(config):
|
||||
custom_list = []
|
||||
file_pba = FileExecution()
|
||||
command_pba = PBA(name="Custom post breach action")
|
||||
command_pba = PBA(name="Custom")
|
||||
post_breach = config.custom_post_breach
|
||||
linux_command = post_breach['linux']
|
||||
windows_command = post_breach['windows']
|
||||
|
|
|
@ -82,7 +82,9 @@ class TelemetryFeed(flask_restful.Resource):
|
|||
|
||||
@staticmethod
|
||||
def get_post_breach_telem_brief(telem):
|
||||
pass
|
||||
return '%s post breach action executed on %s (%s) machine' % (telem['data']['name'],
|
||||
telem['data']['hostname'],
|
||||
telem['data']['ip'])
|
||||
|
||||
|
||||
TELEM_PROCESS_DICT = \
|
||||
|
|
Loading…
Reference in New Issue