forked from p34709852/monkey
Fix bug in displaying edge
This commit is contained in:
parent
ea657e7b7c
commit
104320aa6a
|
@ -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"]})
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -69,9 +69,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
|
||||||
|
|
Loading…
Reference in New Issue