Add node icons

This commit is contained in:
Itay Mizeretz 2017-09-24 15:14:10 +03:00
parent 3b677af440
commit 361064b233
19 changed files with 32 additions and 35 deletions

View File

@ -77,6 +77,10 @@ class NodeService:
os = "windows" os = "windows"
return os return os
@staticmethod
def get_node_os(node):
return node["os"]["type"]
@staticmethod @staticmethod
def get_monkey_manual_run(monkey): def get_monkey_manual_run(monkey):
for p in monkey["parent"]: for p in monkey["parent"]:
@ -96,13 +100,19 @@ class NodeService:
@staticmethod @staticmethod
def get_monkey_group(monkey): def get_monkey_group(monkey):
if len(set(monkey["ip_addresses"]).intersection(local_ip_addresses())) != 0: if len(set(monkey["ip_addresses"]).intersection(local_ip_addresses())) != 0:
return "islandInfected" monkey_type = "island_monkey"
else:
monkey_type = "manual" if NodeService.get_monkey_manual_run(monkey) else "monkey"
return "manuallyInfected" if NodeService.get_monkey_manual_run(monkey) else "infected" monkey_os = NodeService.get_monkey_os(monkey)
monkey_running = "" if monkey["dead"] else "_running"
return "%s_%s%s" % (monkey_type, monkey_os, monkey_running)
@staticmethod @staticmethod
def get_node_group(node): def get_node_group(node):
return "exploited" if node.get("exploited") else "clean" node_type = "exploited" if node.get("exploited") else "clean"
node_os = NodeService.get_node_os(node)
return "%s_%s" % (node_type, node_os)
@staticmethod @staticmethod
def monkey_to_net_node(monkey): def monkey_to_net_node(monkey):
@ -122,7 +132,7 @@ class NodeService:
"id": node["_id"], "id": node["_id"],
"label": NodeService.get_node_label(node), "label": NodeService.get_node_label(node),
"group": NodeService.get_node_group(node), "group": NodeService.get_node_group(node),
"os": node["os"]["type"] "os": NodeService.get_node_os(node)
} }
@staticmethod @staticmethod
@ -221,7 +231,7 @@ class NodeService:
{ {
"id": NodeService.get_monkey_island_pseudo_id(), "id": NodeService.get_monkey_island_pseudo_id(),
"label": "MonkeyIsland", "label": "MonkeyIsland",
"group": "islandClean", "group": "island",
} }
@staticmethod @staticmethod

View File

@ -5,40 +5,27 @@ import PreviewPane from 'components/preview-pane/PreviewPane';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {Icon} from 'react-fa'; import {Icon} from 'react-fa';
let groupsToGroupsOptions = (groupNames) => {
let groupOptions = {};
for (let groupName of groupNames) {
groupOptions[groupName] =
{
shape: 'image',
size: 50,
image: '../images/nodes/' + groupName + '.png'
};
}
return groupOptions;
};
let options = { let options = {
layout: { layout: {
improvedLayout: false improvedLayout: false
}, },
groups: { groups: groupsToGroupsOptions(['clean_linux', 'clean_windows', 'exploited_linux', 'exploited_windows', 'island',
manuallyInfected: { 'island_monkey_linux', 'island_monkey_linux_running', 'island_monkey_windows', 'island_monkey_windows_running',
shape: 'icon', 'manual_linux', 'manual_linux_running', 'manual_windows', 'manual_windows_running', 'monkey_linux',
icon: { 'monkey_linux_running', 'monkey_windows', 'monkey_windows_running'])
face: 'FontAwesome',
code: '\uf120',
size: 50,
color: '#8f5a0b'
}
},
infected: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf06d',
size: 50,
color: '#d30d09'
}
},
clean: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf108',
size: 50,
color: '#999'
}
}
}
}; };
class MapPageComponent extends React.Component { class MapPageComponent extends React.Component {

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB