PR fixes
This commit is contained in:
parent
f4a47f3cb3
commit
c4e384205c
|
@ -23,6 +23,8 @@ DOWNLOAD_CHUNK = 1024
|
||||||
# to prevent the monkey from just waiting forever to try and connect to an island before going elsewhere.
|
# to prevent the monkey from just waiting forever to try and connect to an island before going elsewhere.
|
||||||
TIMEOUT = 15
|
TIMEOUT = 15
|
||||||
|
|
||||||
|
PBA_FILE_DOWNLOAD = "https://%s/api/pba/download/%s"
|
||||||
|
|
||||||
|
|
||||||
class ControlClient(object):
|
class ControlClient(object):
|
||||||
proxies = {}
|
proxies = {}
|
||||||
|
@ -306,3 +308,13 @@ class ControlClient(object):
|
||||||
target_addr, target_port = None, None
|
target_addr, target_port = None, None
|
||||||
|
|
||||||
return tunnel.MonkeyTunnel(proxy_class, target_addr=target_addr, target_port=target_port)
|
return tunnel.MonkeyTunnel(proxy_class, target_addr=target_addr, target_port=target_port)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_pba_file(filename):
|
||||||
|
try:
|
||||||
|
return requests.get(PBA_FILE_DOWNLOAD %
|
||||||
|
(WormConfiguration.current_server, filename),
|
||||||
|
verify=False,
|
||||||
|
proxies=ControlClient.proxies)
|
||||||
|
except requests.exceptions.RequestException:
|
||||||
|
return False
|
||||||
|
|
|
@ -41,15 +41,9 @@ class UsersPBA(PBA):
|
||||||
:return: True if successful, false otherwise
|
:return: True if successful, false otherwise
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
pba_file_contents = ControlClient.get_pba_file(filename)
|
||||||
pba_file_contents = requests.get("https://%s/api/pba/download/%s" %
|
|
||||||
(WormConfiguration.current_server, filename),
|
if not pba_file_contents or not pba_file_contents.content:
|
||||||
verify=False,
|
|
||||||
proxies=ControlClient.proxies)
|
|
||||||
except requests.exceptions.RequestException:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if not pba_file_contents.content:
|
|
||||||
LOG.error("Island didn't respond with post breach file.")
|
LOG.error("Island didn't respond with post breach file.")
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import socket
|
|
||||||
from infection_monkey.control import ControlClient
|
from infection_monkey.control import ControlClient
|
||||||
from infection_monkey.utils import is_windows_os
|
from infection_monkey.utils import is_windows_os
|
||||||
from infection_monkey.config import WormConfiguration
|
from infection_monkey.config import WormConfiguration, GUID
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -53,13 +52,11 @@ class PBA(object):
|
||||||
Runs post breach action command
|
Runs post breach action command
|
||||||
"""
|
"""
|
||||||
exec_funct = self._execute_default
|
exec_funct = self._execute_default
|
||||||
hostname = socket.gethostname()
|
result = exec_funct()
|
||||||
ControlClient.send_telemetry('post_breach', {'command': self.command,
|
ControlClient.send_telemetry('post_breach', {'command': self.command,
|
||||||
'result': exec_funct(),
|
'result': result,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
'hostname': hostname,
|
'guid': GUID})
|
||||||
'ip': socket.gethostbyname(hostname)
|
|
||||||
})
|
|
||||||
|
|
||||||
def _execute_default(self):
|
def _execute_default(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import ReactTable from 'react-table'
|
import ReactTable from 'react-table'
|
||||||
|
|
||||||
let renderArray = function(val) {
|
let renderArray = function(val) {
|
||||||
return <span>{val.map(x => <span> {x}</span>)}</span>;
|
return <span>{val.map(x => <span key={x}> {x}</span>)}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
let renderIpAddresses = function (val) {
|
let renderIpAddresses = function (val) {
|
||||||
|
@ -36,7 +36,7 @@ let renderDetails = function (data) {
|
||||||
columns={subColumns}
|
columns={subColumns}
|
||||||
defaultPageSize={defaultPageSize}
|
defaultPageSize={defaultPageSize}
|
||||||
showPagination={showPagination}
|
showPagination={showPagination}
|
||||||
style={{"background-color": "#ededed"}}
|
style={{"backgroundColor": "#ededed"}}
|
||||||
/>
|
/>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue