Fixed CR comments

This commit is contained in:
VakarisZ 2019-08-20 16:27:48 +03:00
parent 320bcc4c1d
commit fd20d98a8f
4 changed files with 12 additions and 15 deletions

View File

@ -21,7 +21,7 @@ class T1016(AttackTechnique):
'networks': 0, 'networks': 0,
'info': [ 'info': [
{'used': {'$and': [{'$ifNull': ['$netstat', False]}, {'$gt': ['$netstat', {}]}]}, {'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', {}]}]}, {'used': {'$and': [{'$ifNull': ['$networks', False]}, {'$gt': ['$networks', {}]}]},
'name': {'$literal': 'Network interface info'}}, 'name': {'$literal': 'Network interface info'}},
]}}] ]}}]
@ -29,10 +29,7 @@ class T1016(AttackTechnique):
@staticmethod @staticmethod
def get_report_data(): def get_report_data():
network_info = list(mongo.db.telemetry.aggregate(T1016.query)) network_info = list(mongo.db.telemetry.aggregate(T1016.query))
if network_info: status = ScanStatus.USED.value if network_info else ScanStatus.UNSCANNED.value
status = ScanStatus.USED.value
else:
status = ScanStatus.UNSCANNED.value
data = T1016.get_base_data_by_status(status) data = T1016.get_base_data_by_status(status)
data.update({'network_info': network_info}) data.update({'network_info': network_info})
return data return data

View File

@ -36,14 +36,14 @@ export function getUsageColumns() {
style: { 'whiteSpace': 'unset' }}] 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. 'Used' value determines if 'name' value will be shown.
*/ */
export function renderCollections(info){ export function renderUsageFields(usages){
let output = []; let output = [];
info.forEach(function(collection){ usages.forEach(function(usage){
if(collection['used']){ if(usage['used']){
output.push(<div key={collection['name']}>{collection['name']}</div>) output.push(<div key={usage['name']}>{usage['name']}</div>)
} }
}); });
return (<div>{output}</div>); return (<div>{output}</div>);

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import '../../../styles/Collapse.scss' import '../../../styles/Collapse.scss'
import ReactTable from "react-table"; import ReactTable from "react-table";
import { renderMachineFromSystemData, renderCollections, scanStatus } from "./Helpers" import { renderMachineFromSystemData, renderUsageFields, ScanStatus } from "./Helpers"
class T1016 extends React.Component { class T1016 extends React.Component {
@ -15,7 +15,7 @@ class T1016 extends React.Component {
Header: "Network configuration info gathered", Header: "Network configuration info gathered",
columns: [ columns: [
{Header: 'Machine', id: 'machine', accessor: x => renderMachineFromSystemData(x.machine), style: { 'whiteSpace': 'unset' }}, {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>
<div>{this.props.data.message}</div> <div>{this.props.data.message}</div>
<br/> <br/>
{this.props.data.status === scanStatus.USED ? {this.props.data.status === ScanStatus.USED ?
<ReactTable <ReactTable
columns={T1016.getNetworkInfoColumns()} columns={T1016.getNetworkInfoColumns()}
data={this.props.data.network_info} data={this.props.data.network_info}

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import '../../../styles/Collapse.scss' import '../../../styles/Collapse.scss'
import ReactTable from "react-table"; import ReactTable from "react-table";
import { renderMachineFromSystemData, renderCollections, ScanStatus } from "./Helpers" import { renderMachineFromSystemData, renderUsageFields, ScanStatus } from "./Helpers"
class T1082 extends React.Component { class T1082 extends React.Component {
@ -14,7 +14,7 @@ class T1082 extends React.Component {
return ([{ return ([{
columns: [ columns: [
{Header: 'Machine', id: 'machine', accessor: x => renderMachineFromSystemData(x.machine), style: { 'whiteSpace': 'unset' }}, {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' }},
] ]
}])}; }])};