Merge branch 'feature/refactor-monkey-island' of github.com:guardicore/monkey into feature/refactor-monkey-island

This commit is contained in:
Barak Argaman 2017-09-18 14:19:01 +03:00
commit 385fa22b80
5 changed files with 19 additions and 6 deletions

View File

@ -122,7 +122,7 @@ class Telemetry(flask_restful.Resource):
def process_scan_telemetry(self, telemetry_json): def process_scan_telemetry(self, telemetry_json):
edge = self.get_edge_by_scan_or_exploit_telemetry(telemetry_json) edge = self.get_edge_by_scan_or_exploit_telemetry(telemetry_json)
data = telemetry_json['data']['machine'] data = telemetry_json['data']['machine']
data.pop("ip_addr") ip_address = data.pop("ip_addr")
new_scan = \ new_scan = \
{ {
"timestamp": telemetry_json["timestamp"], "timestamp": telemetry_json["timestamp"],
@ -131,7 +131,8 @@ class Telemetry(flask_restful.Resource):
} }
mongo.db.edge.update( mongo.db.edge.update(
{"_id": edge["_id"]}, {"_id": edge["_id"]},
{"$push": {"scans": new_scan}} {"$push": {"scans": new_scan},
"$set": {"ip_address": ip_address}}
) )
node = mongo.db.node.find_one({"_id": edge["to"]}) node = mongo.db.node.find_one({"_id": edge["to"]})

View File

@ -60,6 +60,7 @@ class EdgeService:
"id": edge["_id"], "id": edge["_id"],
"from": edge["from"], "from": edge["from"],
"to": edge["to"], "to": edge["to"],
"ip_address": edge["ip_address"],
"services": services, "services": services,
"os": os, "os": os,
"exploits": exploits "exploits": exploits

View File

@ -51,6 +51,8 @@ class NodeService:
new_node["accessible_from_nodes"] = accessible_from_nodes new_node["accessible_from_nodes"] = accessible_from_nodes
if len(edges) > 0: if len(edges) > 0:
new_node["services"] = edges[-1]["services"] new_node["services"] = edges[-1]["services"]
else:
new_node["services"] = []
return new_node return new_node

View File

@ -93,9 +93,18 @@ class MapPageComponent extends React.Component {
.then(res => this.setState({selected: res, selectedType: 'node'})); .then(res => this.setState({selected: res, selectedType: 'node'}));
} }
else if (event.edges.length === 1) { else if (event.edges.length === 1) {
fetch('/api/netmap/edge?id='+event.edges[0]) let edgeGroup = this.state.graph.edges.filter(
.then(res => res.json()) function(edge) {
.then(res => this.setState({selected: res.edge, selectedType: 'edge'})); return edge['id'] === event.edges[0];
})[0]['group'];
if (edgeGroup == 'island') {
console.log('selection cleared.'); // eslint-disable-line no-console
this.setState({selected: null, selectedType: null});
} else {
fetch('/api/netmap/edge?id='+event.edges[0])
.then(res => res.json())
.then(res => this.setState({selected: res.edge, selectedType: 'edge'}));
}
} }
else { else {
console.log('selection cleared.'); // eslint-disable-line no-console console.log('selection cleared.'); // eslint-disable-line no-console

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Monkey Island C&C Server</title> <title>Infection Monkey C&C</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">