From 787d08db5763683fa7aa79624788bf5160fd5739 Mon Sep 17 00:00:00 2001
From: Itay Mizeretz
Date: Mon, 18 Sep 2017 19:00:25 +0300
Subject: [PATCH] Fix telemetry tunnel processing Split snippets per os.
selected by button
---
monkey_island/cc/resources/telemetry.py | 2 +-
.../ui/src/components/pages/RunMonkeyPage.js | 36 +++++++++++--------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/monkey_island/cc/resources/telemetry.py b/monkey_island/cc/resources/telemetry.py
index 4db48e010..a03ebb904 100644
--- a/monkey_island/cc/resources/telemetry.py
+++ b/monkey_island/cc/resources/telemetry.py
@@ -88,7 +88,7 @@ class Telemetry(flask_restful.Resource):
def process_tunnel_telemetry(self, telemetry_json):
monkey_id = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])["_id"]
- if telemetry_json['data']['proxy'] is not None:
+ if telemetry_json['data'] is not None:
host = telemetry_json['data']['proxy'].split(":")[-2].replace("//", "")
tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"]
NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id)
diff --git a/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js b/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
index eb91ae606..1ed35828b 100644
--- a/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
+++ b/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
@@ -1,5 +1,5 @@
import React from 'react';
-import {Button, Col, Well} from 'react-bootstrap';
+import {Button, Col, Well, Nav, NavItem} from 'react-bootstrap';
import CopyToClipboard from 'react-copy-to-clipboard';
import {Icon} from 'react-fa';
import {Link} from "react-router-dom";
@@ -11,7 +11,8 @@ class RunMonkeyPageComponent extends React.Component {
ips: [],
selectedIp: '0.0.0.0',
isRunningOnIsland: false,
- isRunningLocally: false
+ isRunningLocally: false,
+ selectedSection: "windows-32"
};
}
@@ -56,7 +57,9 @@ class RunMonkeyPageComponent extends React.Component {
});
};
- generateCmdDiv(ip, isLinux, is32Bit) {
+ generateCmdDiv(ip) {
+ let isLinux = (this.state.selectedSection.split('-')[0] === "linux");
+ let is32Bit = (this.state.selectedSection.split('-')[1] === "32");
let cmdText = "";
if (isLinux) {
cmdText = this.generateLinuxCmd(ip, is32Bit);
@@ -77,6 +80,12 @@ class RunMonkeyPageComponent extends React.Component {
)
}
+ setSelectedSection = (key) => {
+ this.setState({
+ selectedSection: key
+ });
+ };
+
render() {
return (
@@ -110,18 +119,15 @@ class RunMonkeyPageComponent extends React.Component {
(The IP address is used as the monkey's C&C address)
-
- {this.state.ips.map(ip =>
-
- [
- this.generateCmdDiv(ip, true, true),
- this.generateCmdDiv(ip, true, false),
- this.generateCmdDiv(ip, false, true),
- this.generateCmdDiv(ip, false, false)
- ]
-
- )}
-
+
+ {this.state.ips.map(ip => this.generateCmdDiv(ip))}
Go ahead and monitor the ongoing infection in the Infection Map view.