Island: remove the redundant line with total amount of exploited machines from ransomware report + small improvements in monkey_exploitation.py

This commit is contained in:
VakarisZ 2021-07-28 16:57:06 +03:00
parent 4c1747d2e6
commit 8583303682
3 changed files with 12 additions and 8 deletions

View File

@ -20,18 +20,20 @@ class MonkeyExploitation:
def get_monkey_exploited() -> List[MonkeyExploitation]:
exploited_with_monkeys = [
exploited_nodes_monkeys_launched = [
NodeService.get_displayed_node_by_id(monkey["_id"], True)
for monkey in mongo.db.monkey.find({}, {"_id": 1})
if not NodeService.get_monkey_manual_run(NodeService.get_monkey_by_id(monkey["_id"]))
]
exploited_without_monkeys = [
# The node got exploited, but no monkeys got launched.
# For example the exploited machine was too old.
exploited_nodes_monkeys_failed = [
NodeService.get_displayed_node_by_id(node["_id"], True)
for node in mongo.db.node.find({"exploited": True}, {"_id": 1})
]
exploited = exploited_with_monkeys + exploited_without_monkeys
exploited = exploited_nodes_monkeys_launched + exploited_nodes_monkeys_failed
exploited = [
MonkeyExploitation(

View File

@ -1,4 +1,5 @@
import React, {Fragment} from 'react';
import Pluralize from 'pluralize';
import BreachedServers from 'components/report-components/security/BreachedServers';
import ScannedServers from 'components/report-components/security/ScannedServers';
import PostBreach from 'components/report-components/security/PostBreach';
@ -566,6 +567,12 @@ class ReportPageComponent extends AuthComponent {
</div>
<div style={{marginBottom: '20px'}}>
<p>
The Monkey successfully breached&nbsp;
<span className="badge badge-danger">
{this.state.report.glance.exploited_cnt}
</span> {Pluralize('machine', this.state.report.glance.exploited_cnt)}:
</p>
<BreachedServers />
</div>

View File

@ -1,6 +1,5 @@
import React, {useEffect, useState} from 'react';
import ReactTable from 'react-table';
import Pluralize from 'pluralize';
import {renderArray, renderIpAddresses} from '../common/RenderArrays';
import LoadingIcon from '../../ui-components/LoadingIcon';
import IslandHttpClient from '../../IslandHttpClient';
@ -39,10 +38,6 @@ function BreachedServersComponent() {
let showPagination = exploitations.length > pageSize;
return (
<>
<p>
The Monkey successfully breached <span
className="badge badge-danger">{exploitations.length}</span> {Pluralize('machine', exploitations.length)}:
</p>
<div className="data-table-container">
<ReactTable
columns={columns}