forked from p15670423/monkey
Revert "WIP - initial code, just trying to make a POST request work"
This reverts commit 026cb41064
.
This commit is contained in:
parent
e142ca7c44
commit
bf0b812f73
|
@ -1,7 +1,4 @@
|
||||||
import json
|
|
||||||
|
|
||||||
import flask_restful
|
import flask_restful
|
||||||
from flask import request
|
|
||||||
|
|
||||||
from monkey_island.cc.auth import jwt_required
|
from monkey_island.cc.auth import jwt_required
|
||||||
from monkey_island.cc.services.edge import EdgeService
|
from monkey_island.cc.services.edge import EdgeService
|
||||||
|
@ -31,32 +28,4 @@ class NetMap(flask_restful.Resource):
|
||||||
"edges": edges
|
"edges": edges
|
||||||
}
|
}
|
||||||
|
|
||||||
@jwt_required()
|
|
||||||
def post(self, **kw):
|
|
||||||
post_data = json.loads(request.data)
|
|
||||||
|
|
||||||
print(post_data)
|
|
||||||
|
|
||||||
monkeys = [NodeService.monkey_to_net_node(x) for x in mongo.db.monkey.find({})]
|
|
||||||
nodes = [NodeService.node_to_net_node(x) for x in mongo.db.node.find({})]
|
|
||||||
edges = [EdgeService.edge_to_net_edge(x) for x in mongo.db.edge.find({})]
|
|
||||||
|
|
||||||
if NodeService.get_monkey_island_monkey() is None:
|
|
||||||
monkey_island = [NodeService.get_monkey_island_pseudo_net_node()]
|
|
||||||
edges += EdgeService.get_monkey_island_pseudo_edges()
|
|
||||||
else:
|
|
||||||
monkey_island = []
|
|
||||||
edges += EdgeService.get_infected_monkey_island_pseudo_edges()
|
|
||||||
|
|
||||||
all_nodes = monkeys + nodes + monkey_island
|
|
||||||
def filter_linux(machine):
|
|
||||||
if machine["os"] == "linux":
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
all_nodes = filter(filter_linux, all_nodes)
|
|
||||||
|
|
||||||
return \
|
|
||||||
{
|
|
||||||
"nodes": all_nodes,
|
|
||||||
"edges": edges
|
|
||||||
}
|
|
||||||
|
|
|
@ -103,17 +103,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMapFromServer = () => {
|
updateMapFromServer = () => {
|
||||||
this.authFetch('/api/netmap', {
|
this.authFetch('/api/netmap')
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
firstParam: 'yourValue',
|
|
||||||
secondParam: 'yourOtherValue',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
res.edges.forEach(edge => {
|
res.edges.forEach(edge => {
|
||||||
|
|
Loading…
Reference in New Issue