Sort recommendations by machine

This commit is contained in:
Itay Mizeretz 2017-11-28 14:33:41 +02:00
parent 046b18e71c
commit 10375c093e
2 changed files with 5 additions and 3 deletions

View File

@ -43,7 +43,7 @@ class ReportService:
return [ return [
{ {
'type': 'tunnel', 'type': 'tunnel',
'origin': NodeService.get_node_hostname(NodeService.get_node_or_monkey_by_id(tunnel['_id'])), 'machine': NodeService.get_node_hostname(NodeService.get_node_or_monkey_by_id(tunnel['_id'])),
'dest': NodeService.get_node_hostname(NodeService.get_node_or_monkey_by_id(tunnel['tunnel'])) 'dest': NodeService.get_node_hostname(NodeService.get_node_or_monkey_by_id(tunnel['tunnel']))
} }
for tunnel in mongo.db.monkey.find({'tunnel': {'$exists': True}}, {'tunnel': 1})] for tunnel in mongo.db.monkey.find({'tunnel': {'$exists': True}}, {'tunnel': 1})]
@ -251,7 +251,9 @@ class ReportService:
@staticmethod @staticmethod
def get_issues(): def get_issues():
return ReportService.get_exploits() + ReportService.get_tunnels() + ReportService.get_cross_segment_issues() issues = ReportService.get_exploits() + ReportService.get_tunnels() + ReportService.get_cross_segment_issues()
issues.sort(lambda x, y: 1 if x['machine'] > y['machine'] else -1 if x['machine'] < y['machine'] else 0)
return issues
@staticmethod @staticmethod
def get_report(): def get_report():

View File

@ -240,7 +240,7 @@ class ReportPageComponent extends React.Component {
generateTunnelIssue(issue) { generateTunnelIssue(issue) {
return ( return (
<div> <div>
Machines are not locked down at port level. Network tunnel was set up from <span className="label label-primary">{issue.origin}</span> to <span className="label label-primary">{issue.dest}</span>. Machines are not locked down at port level. Network tunnel was set up from <span className="label label-primary">{issue.machine}</span> to <span className="label label-primary">{issue.dest}</span>.
<br /> <br />
In order to protect the machine, the following steps should be performed: In order to protect the machine, the following steps should be performed:
<ul className="report"> <ul className="report">