forked from p34709852/monkey
Fixed CR comments
This commit is contained in:
parent
320bcc4c1d
commit
fd20d98a8f
|
@ -21,7 +21,7 @@ class T1016(AttackTechnique):
|
|||
'networks': 0,
|
||||
'info': [
|
||||
{'used': {'$and': [{'$ifNull': ['$netstat', False]}, {'$gt': ['$netstat', {}]}]},
|
||||
'name': {'$literal': 'Network connections (via netstat command)'}},
|
||||
'name': {'$literal': 'Network connections (netstat)'}},
|
||||
{'used': {'$and': [{'$ifNull': ['$networks', False]}, {'$gt': ['$networks', {}]}]},
|
||||
'name': {'$literal': 'Network interface info'}},
|
||||
]}}]
|
||||
|
@ -29,10 +29,7 @@ class T1016(AttackTechnique):
|
|||
@staticmethod
|
||||
def get_report_data():
|
||||
network_info = list(mongo.db.telemetry.aggregate(T1016.query))
|
||||
if network_info:
|
||||
status = ScanStatus.USED.value
|
||||
else:
|
||||
status = ScanStatus.UNSCANNED.value
|
||||
status = ScanStatus.USED.value if network_info else ScanStatus.UNSCANNED.value
|
||||
data = T1016.get_base_data_by_status(status)
|
||||
data.update({'network_info': network_info})
|
||||
return data
|
||||
|
|
|
@ -36,14 +36,14 @@ export function getUsageColumns() {
|
|||
style: { 'whiteSpace': 'unset' }}]
|
||||
}])}
|
||||
|
||||
/* Renders fields that contains 'used' boolean value and 'name' string value.
|
||||
/* Renders table fields that contains 'used' boolean value and 'name' string value.
|
||||
'Used' value determines if 'name' value will be shown.
|
||||
*/
|
||||
export function renderCollections(info){
|
||||
export function renderUsageFields(usages){
|
||||
let output = [];
|
||||
info.forEach(function(collection){
|
||||
if(collection['used']){
|
||||
output.push(<div key={collection['name']}>{collection['name']}</div>)
|
||||
usages.forEach(function(usage){
|
||||
if(usage['used']){
|
||||
output.push(<div key={usage['name']}>{usage['name']}</div>)
|
||||
}
|
||||
});
|
||||
return (<div>{output}</div>);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import '../../../styles/Collapse.scss'
|
||||
import ReactTable from "react-table";
|
||||
import { renderMachineFromSystemData, renderCollections, scanStatus } from "./Helpers"
|
||||
import { renderMachineFromSystemData, renderUsageFields, ScanStatus } from "./Helpers"
|
||||
|
||||
|
||||
class T1016 extends React.Component {
|
||||
|
@ -15,7 +15,7 @@ class T1016 extends React.Component {
|
|||
Header: "Network configuration info gathered",
|
||||
columns: [
|
||||
{Header: 'Machine', id: 'machine', accessor: x => renderMachineFromSystemData(x.machine), style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Network info', id: 'info', accessor: x => renderCollections(x.info), style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Network info', id: 'info', accessor: x => renderUsageFields(x.info), style: { 'whiteSpace': 'unset' }},
|
||||
]
|
||||
}])};
|
||||
|
||||
|
@ -24,7 +24,7 @@ class T1016 extends React.Component {
|
|||
<div>
|
||||
<div>{this.props.data.message}</div>
|
||||
<br/>
|
||||
{this.props.data.status === scanStatus.USED ?
|
||||
{this.props.data.status === ScanStatus.USED ?
|
||||
<ReactTable
|
||||
columns={T1016.getNetworkInfoColumns()}
|
||||
data={this.props.data.network_info}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import '../../../styles/Collapse.scss'
|
||||
import ReactTable from "react-table";
|
||||
import { renderMachineFromSystemData, renderCollections, ScanStatus } from "./Helpers"
|
||||
import { renderMachineFromSystemData, renderUsageFields, ScanStatus } from "./Helpers"
|
||||
|
||||
|
||||
class T1082 extends React.Component {
|
||||
|
@ -14,7 +14,7 @@ class T1082 extends React.Component {
|
|||
return ([{
|
||||
columns: [
|
||||
{Header: 'Machine', id: 'machine', accessor: x => renderMachineFromSystemData(x.machine), style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Gathered info', id: 'info', accessor: x => renderCollections(x.collections), style: { 'whiteSpace': 'unset' }},
|
||||
{Header: 'Gathered info', id: 'info', accessor: x => renderUsageFields(x.collections), style: { 'whiteSpace': 'unset' }},
|
||||
]
|
||||
}])};
|
||||
|
||||
|
|
Loading…
Reference in New Issue