Skip to content

Commit

Permalink
Allow clickable nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Oct 3, 2020
1 parent c9be842 commit 6251036
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/report_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-color: #5c5554;
background-color: #293142;
color: #333;
margin: 0 auto;
width: 960px;
Expand Down
13 changes: 11 additions & 2 deletions templates/topology.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ <h3>Network Topology</i></h3>
nodes.push({id: "{{key}}", label: '{{value.rule_confirm}}', group: 'vulnerability_low', value: 1});
edges.push({from: "{{value.ip}}", to: "{{key}}", label: "{{value.port}}", length: 140, width: WIDTH_SCALE * 1, color:RED});
{% elif value.rule_sev == 2 %}
nodes.push({id: "{{key}}", label: '{{value.rule_confirm}}', group: 'vulnerability_med', value: 1});
edges.push({from: "{{value.ip}}", to: "{{key}}", label: "{{value.port}}", length: 140, width: WIDTH_SCALE * 1, color:RED});
nodes.push({id: "{{key}}",label: '{{value.rule_confirm}}', group: 'vulnerability_med', value: 1});
edges.push({from: "{{value.ip}}", to: "{{key}}", label: "{{value.port}}", length: 140,width: WIDTH_SCALE * 1, color:RED});
{% elif value.rule_sev == 3 %}
nodes.push({id: "{{key}}", label: '{{value.rule_confirm}}', group: 'vulnerability_high', value: 1});
edges.push({from: "{{value.ip}}", to: "{{key}}", label: "{{value.port}}", length: 140, width: WIDTH_SCALE * 1, color:RED});
Expand Down Expand Up @@ -221,6 +221,15 @@ <h3>Network Topology</i></h3>
}
};
network = new vis.Network(container, data, options);

network.on( 'click', function(properties) {
node_id = properties.nodes[0]
if(properties.nodes[0] && String(properties.nodes[0]).startsWith('vuln_'))
{
window.open("/alert/view/" + properties.nodes[0], '_blank');
}

});

}

Expand Down

0 comments on commit 6251036

Please sign in to comment.