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