From 7ef2e3cabc618fe6b172bd60b4fdfef2fc517e1c Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Thu, 14 Sep 2017 18:20:00 +0300 Subject: [PATCH 1/2] Remove empty sub-namespace --- monkey_island/cc/services/config.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/monkey_island/cc/services/config.py b/monkey_island/cc/services/config.py index d996b3cdc..08eb0e329 100644 --- a/monkey_island/cc/services/config.py +++ b/monkey_island/cc/services/config.py @@ -338,12 +338,6 @@ SCHEMA = { "title": "C&C", "type": "object", "properties": { - "general": { - "title": "General", - "type": "object", - "properties": { - } - }, "servers": { "title": "Servers", "type": "object", From e37a0a98630fdd673166aa7d149031db577946cd Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Thu, 14 Sep 2017 19:01:42 +0300 Subject: [PATCH 2/2] Change full logs cosmetics --- monkey_island/cc/resources/telemetry.py | 19 ++++++++++++++++++- .../ui/src/components/pages/FullLogsPage.js | 8 ++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/monkey_island/cc/resources/telemetry.py b/monkey_island/cc/resources/telemetry.py index 1c17c1fa0..760b72003 100644 --- a/monkey_island/cc/resources/telemetry.py +++ b/monkey_island/cc/resources/telemetry.py @@ -32,7 +32,7 @@ class Telemetry(flask_restful.Resource): if timestamp: find_filter['timestamp'] = {'$gt': dateutil.parser.parse(timestamp)} - result['objects'] = [x for x in mongo.db.telemetry.find(find_filter)] + result['objects'] = self.telemetry_to_displayed_telemetry(mongo.db.telemetry.find(find_filter)) return result def post(self): @@ -60,6 +60,23 @@ class Telemetry(flask_restful.Resource): return mongo.db.telemetry.find_one_or_404({"_id": telem_id}) + def telemetry_to_displayed_telemetry(self, telemetry): + monkey_guid_dict = {} + monkeys = mongo.db.monkey.find({}) + for monkey in monkeys: + monkey_guid_dict[monkey["guid"]] = NodeService.get_monkey_label(monkey) + + objects = [] + for x in telemetry: + telem_monkey_guid = x.pop("monkey_guid") + monkey_label = monkey_guid_dict.get(telem_monkey_guid) + if monkey_label is None: + monkey_label = telem_monkey_guid + x["monkey"] = monkey_label + objects.append(x) + + return objects + def get_edge_by_scan_or_exploit_telemetry(self, telemetry_json): dst_ip = telemetry_json['data']['machine']['ip_addr'] src_monkey = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid']) diff --git a/monkey_island/cc/ui/src/components/pages/FullLogsPage.js b/monkey_island/cc/ui/src/components/pages/FullLogsPage.js index 837e12c1f..fc28aa583 100644 --- a/monkey_island/cc/ui/src/components/pages/FullLogsPage.js +++ b/monkey_island/cc/ui/src/components/pages/FullLogsPage.js @@ -7,10 +7,10 @@ const renderJson = (val, row) => val.split('.')[0]; const columns = [ - { title: 'Type', prop: 'telem_type' }, - { title: 'Monkey ID', prop: 'monkey_guid' }, { title: 'Time', prop: 'timestamp', render: renderTime}, - { title: 'More Info', prop: 'data', render: renderJson, width: '40%' } + { title: 'Monkey', prop: 'monkey' }, + { title: 'Type', prop: 'telem_type' }, + { title: 'Details', prop: 'data', render: renderJson, width: '40%' } ]; class FullLogsPageComponent extends React.Component { @@ -30,7 +30,7 @@ class FullLogsPageComponent extends React.Component { render() { return ( -

Full Logs

+

Monkey Telemetry