diff --git a/chaos_monkey/control.py b/chaos_monkey/control.py
index fef37de1f..dd1814133 100644
--- a/chaos_monkey/control.py
+++ b/chaos_monkey/control.py
@@ -1,4 +1,3 @@
-import base64
import json
import logging
import platform
@@ -117,7 +116,7 @@ class ControlClient(object):
if not WormConfiguration.current_server:
return
try:
- telemetry = {'monkey_guid': GUID, 'log': base64.b64encode(log)}
+ telemetry = {'monkey_guid': GUID, 'log': json.dumps(log)}
reply = requests.post("https://%s/api/log" % (WormConfiguration.current_server,),
data=json.dumps(telemetry),
headers={'content-type': 'application/json'},
diff --git a/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js b/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js
index 56c6d0e75..b7f055103 100644
--- a/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js
+++ b/monkey_island/cc/ui/src/components/map/preview-pane/PreviewPane.js
@@ -82,22 +82,34 @@ class PreviewPaneComponent extends React.Component {
this.forceKill(e, asset)} />
+ onChange={(e) => this.forceKill(e, asset)}/>
|
);
}
- downloadLog(asset) {
+ unescapeLog(st) {
+ return st.substr(1, st.length - 2) // remove quotation marks on beginning and end of string.
+ .replace(/\\n/g, "\n")
+ .replace(/\\r/g, "\r")
+ .replace(/\\t/g, "\t")
+ .replace(/\\b/g, "\b")
+ .replace(/\\f/g, "\f")
+ .replace(/\\"/g, '\"')
+ .replace(/\\'/g, "\'")
+ .replace(/\\&/g, "\&");
+ }
+ downloadLog(asset) {
fetch('/api/log?id=' + asset.id)
.then(res => res.json())
.then(res => {
let timestamp = res['timestamp'];
timestamp = timestamp.substr(0, timestamp.indexOf('.'));
let filename = res['monkey_label'].split(':').join('-') + ' - ' + timestamp + '.log';
- download(atob(res['log']), filename, 'text/plain');
+ let logContent = this.unescapeLog(res['log']);
+ download(logContent, filename, 'text/plain');
});
}
@@ -119,7 +131,7 @@ class PreviewPaneComponent extends React.Component {
exploitsTimeline(asset) {
if (asset.exploits.length === 0) {
- return ();
+ return ();
}
return (
@@ -129,9 +141,9 @@ class PreviewPaneComponent extends React.Component {
{this.generateToolTip('Timeline of exploit attempts. Red is successful. Gray is unsuccessful')}