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 [
{
'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']))
}
for tunnel in mongo.db.monkey.find({'tunnel': {'$exists': True}}, {'tunnel': 1})]
@ -251,7 +251,9 @@ class ReportService:
@staticmethod
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
def get_report():

View File

@ -240,7 +240,7 @@ class ReportPageComponent extends React.Component {
generateTunnelIssue(issue) {
return (
<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 />
In order to protect the machine, the following steps should be performed:
<ul className="report">