From bf0b812f7330f8ae4f518d2de720e7598e419c63 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Wed, 5 Jun 2019 17:18:52 +0300 Subject: [PATCH] Revert "WIP - initial code, just trying to make a POST request work" This reverts commit 026cb41064150191609b05805dd6d24a06a13b3c. --- monkey/monkey_island/cc/resources/netmap.py | 31 ------------------- .../cc/ui/src/components/pages/ReportPage.js | 12 +------ 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/monkey/monkey_island/cc/resources/netmap.py b/monkey/monkey_island/cc/resources/netmap.py index 96ea38b28..ed83414f5 100644 --- a/monkey/monkey_island/cc/resources/netmap.py +++ b/monkey/monkey_island/cc/resources/netmap.py @@ -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 - } diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js index 65a8b9003..eb94792ab 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js @@ -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 => {