Revert "WIP - initial code, just trying to make a POST request work"

This reverts commit 026cb41064.
This commit is contained in:
Shay Nehmad 2019-06-05 17:18:52 +03:00
parent e142ca7c44
commit bf0b812f73
2 changed files with 1 additions and 42 deletions

View File

@ -1,7 +1,4 @@
import json
import flask_restful
from flask import request
from monkey_island.cc.auth import jwt_required
from monkey_island.cc.services.edge import EdgeService
@ -31,32 +28,4 @@ class NetMap(flask_restful.Resource):
"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
}

View File

@ -103,17 +103,7 @@ class ReportPageComponent extends AuthComponent {
};
updateMapFromServer = () => {
this.authFetch('/api/netmap', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstParam: 'yourValue',
secondParam: 'yourOtherValue',
})
})
this.authFetch('/api/netmap')
.then(res => res.json())
.then(res => {
res.edges.forEach(edge => {