Fix telemetry tunnel processing

Split snippets per os. selected by button
This commit is contained in:
Itay Mizeretz 2017-09-18 19:00:25 +03:00
parent addf9f0b4a
commit 787d08db57
2 changed files with 22 additions and 16 deletions

View File

@ -88,7 +88,7 @@ class Telemetry(flask_restful.Resource):
def process_tunnel_telemetry(self, telemetry_json): def process_tunnel_telemetry(self, telemetry_json):
monkey_id = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])["_id"] 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("//", "") host = telemetry_json['data']['proxy'].split(":")[-2].replace("//", "")
tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"] tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"]
NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id) NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id)

View File

@ -1,5 +1,5 @@
import React from 'react'; 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 CopyToClipboard from 'react-copy-to-clipboard';
import {Icon} from 'react-fa'; import {Icon} from 'react-fa';
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
@ -11,7 +11,8 @@ class RunMonkeyPageComponent extends React.Component {
ips: [], ips: [],
selectedIp: '0.0.0.0', selectedIp: '0.0.0.0',
isRunningOnIsland: false, 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 = ""; let cmdText = "";
if (isLinux) { if (isLinux) {
cmdText = this.generateLinuxCmd(ip, is32Bit); cmdText = this.generateLinuxCmd(ip, is32Bit);
@ -77,6 +80,12 @@ class RunMonkeyPageComponent extends React.Component {
) )
} }
setSelectedSection = (key) => {
this.setState({
selectedSection: key
});
};
render() { render() {
return ( return (
<Col xs={8}> <Col xs={8}>
@ -110,18 +119,15 @@ class RunMonkeyPageComponent extends React.Component {
<br/> <br/>
<span className="text-muted">(The IP address is used as the monkey's C&C address)</span> <span className="text-muted">(The IP address is used as the monkey's C&C address)</span>
</p> </p>
<Nav pills justified
{this.state.ips.map(ip => activeKey={this.state.selectedSection} onSelect={this.setSelectedSection}
style={{'marginBottom': '2em'}}>
[ <NavItem key='windows-32' eventKey='windows-32'>Windows (32 bit)</NavItem>
this.generateCmdDiv(ip, true, true), <NavItem key='windows-64' eventKey='windows-64'>Windows (64 bit)</NavItem>
this.generateCmdDiv(ip, true, false), <NavItem key='linux-32' eventKey='linux-32'>Linux (32 bit)</NavItem>
this.generateCmdDiv(ip, false, true), <NavItem key='linux-64' eventKey='linux-64'>Linux (64 bit)</NavItem>
this.generateCmdDiv(ip, false, false) </Nav>
] {this.state.ips.map(ip => this.generateCmdDiv(ip))}
)}
</div> </div>
<p style={{'fontSize': '1.2em'}}> <p style={{'fontSize': '1.2em'}}>
Go ahead and monitor the ongoing infection in the <Link to="/infection/map">Infection Map</Link> view. Go ahead and monitor the ongoing infection in the <Link to="/infection/map">Infection Map</Link> view.