diff --git a/monkey/infection_monkey/control.py b/monkey/infection_monkey/control.py
index 98ad55671..088cdd7b3 100644
--- a/monkey/infection_monkey/control.py
+++ b/monkey/infection_monkey/control.py
@@ -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.
TIMEOUT = 15
+PBA_FILE_DOWNLOAD = "https://%s/api/pba/download/%s"
+
class ControlClient(object):
proxies = {}
@@ -306,3 +308,13 @@ class ControlClient(object):
target_addr, target_port = None, None
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
diff --git a/monkey/infection_monkey/post_breach/actions/users_custom_pba.py b/monkey/infection_monkey/post_breach/actions/users_custom_pba.py
index f92035a57..a13064cb4 100644
--- a/monkey/infection_monkey/post_breach/actions/users_custom_pba.py
+++ b/monkey/infection_monkey/post_breach/actions/users_custom_pba.py
@@ -41,15 +41,9 @@ class UsersPBA(PBA):
:return: True if successful, false otherwise
"""
- try:
- pba_file_contents = requests.get("https://%s/api/pba/download/%s" %
- (WormConfiguration.current_server, filename),
- verify=False,
- proxies=ControlClient.proxies)
- except requests.exceptions.RequestException:
- return False
-
- if not pba_file_contents.content:
+ pba_file_contents = ControlClient.get_pba_file(filename)
+
+ if not pba_file_contents or not pba_file_contents.content:
LOG.error("Island didn't respond with post breach file.")
return False
try:
diff --git a/monkey/infection_monkey/post_breach/pba.py b/monkey/infection_monkey/post_breach/pba.py
index fa1f57c98..12de8c760 100644
--- a/monkey/infection_monkey/post_breach/pba.py
+++ b/monkey/infection_monkey/post_breach/pba.py
@@ -1,9 +1,8 @@
import logging
import subprocess
-import socket
from infection_monkey.control import ControlClient
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__)
@@ -53,13 +52,11 @@ class PBA(object):
Runs post breach action command
"""
exec_funct = self._execute_default
- hostname = socket.gethostname()
+ result = exec_funct()
ControlClient.send_telemetry('post_breach', {'command': self.command,
- 'result': exec_funct(),
+ 'result': result,
'name': self.name,
- 'hostname': hostname,
- 'ip': socket.gethostbyname(hostname)
- })
+ 'guid': GUID})
def _execute_default(self):
"""
diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/PostBreach.js b/monkey/monkey_island/cc/ui/src/components/report-components/PostBreach.js
index 763b35de8..aacdc8845 100644
--- a/monkey/monkey_island/cc/ui/src/components/report-components/PostBreach.js
+++ b/monkey/monkey_island/cc/ui/src/components/report-components/PostBreach.js
@@ -2,7 +2,7 @@ import React from 'react';
import ReactTable from 'react-table'
let renderArray = function(val) {
- return {val.map(x => {x})};
+ return {val.map(x => {x})};
};
let renderIpAddresses = function (val) {
@@ -36,7 +36,7 @@ let renderDetails = function (data) {
columns={subColumns}
defaultPageSize={defaultPageSize}
showPagination={showPagination}
- style={{"background-color": "#ededed"}}
+ style={{"backgroundColor": "#ededed"}}
/>
};