Fixing code style issues to lower linter warnings number

This commit is contained in:
Shay Nehmad 2019-11-10 15:51:54 +02:00
parent 3607547aea
commit d36ec06e91
72 changed files with 409 additions and 418 deletions

View File

@ -14,7 +14,7 @@ import ZeroTrustReportPage from 'components/pages/ZeroTrustReportPage';
import LicensePage from 'components/pages/LicensePage';
import AuthComponent from 'components/AuthComponent';
import LoginPageComponent from 'components/pages/LoginPage';
import Notifier from "react-desktop-notification"
import Notifier from 'react-desktop-notification'
import 'normalize.css/normalize.css';
@ -22,7 +22,7 @@ import 'react-data-components/css/table-twbs.css';
import 'styles/App.css';
import 'react-toggle/style.css';
import 'react-table/react-table.css';
import VersionComponent from "./side-menu/VersionComponent";
import VersionComponent from './side-menu/VersionComponent';
let logoImage = require('../images/monkey-icon.svg');
let infectionMonkeyImage = require('../images/infection-monkey.svg');
@ -63,7 +63,7 @@ class AppComponent extends AuthComponent {
};
renderRoute = (route_path, page_component, is_exact_path = false) => {
let render_func = (props) => {
let render_func = () => {
switch (this.state.isLoggedIn) {
case true:
return page_component;
@ -92,7 +92,7 @@ class AppComponent extends AuthComponent {
infection_done: false,
report_done: false,
isLoggedIn: undefined
},
}
};
}
@ -194,7 +194,7 @@ class AppComponent extends AuthComponent {
<VersionComponent/>
</Col>
<Col sm={9} md={10} smOffset={3} mdOffset={2} className="main">
<Route path='/login' render={(props) => (<LoginPageComponent onStatusChange={this.updateStatus}/>)}/>
<Route path='/login' render={() => (<LoginPageComponent onStatusChange={this.updateStatus}/>)}/>
{this.renderRoute('/', <RunServerPage onStatusChange={this.updateStatus}/>, true)}
{this.renderRoute('/configure', <ConfigurePage onStatusChange={this.updateStatus}/>)}
{this.renderRoute('/run-monkey', <RunMonkeyPage onStatusChange={this.updateStatus}/>)}
@ -219,8 +219,8 @@ class AppComponent extends AuthComponent {
const url = `${protocol}//${hostname}:${port}${reportZeroTrustRoute}`;
Notifier.start(
"Monkey Island",
"Infection is done! Click here to go to the report page.",
'Monkey Island',
'Infection is done! Click here to go to the report page.',
url,
notificationIcon);
}
@ -228,7 +228,7 @@ class AppComponent extends AuthComponent {
shouldShowNotification() {
// No need to show the notification to redirect to the report if we're already in the report page
return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith("/report"));
return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith('/report'));
}
}

View File

@ -2,16 +2,16 @@ import React from 'react';
import Checkbox from '../ui-components/Checkbox'
import Tooltip from 'react-tooltip-lite'
import AuthComponent from '../AuthComponent';
import ReactTable from "react-table";
import ReactTable from 'react-table';
import 'filepond/dist/filepond.min.css';
import '../../styles/Tooltip.scss';
import {Col} from "react-bootstrap";
import {Col} from 'react-bootstrap';
class MatrixComponent extends AuthComponent {
constructor(props) {
super(props);
this.state = {lastAction: 'none'}
};
}
// Finds which attack type has most techniques and returns that number
static findMaxTechniques(data) {
@ -22,7 +22,7 @@ class MatrixComponent extends AuthComponent {
}
});
return maxLen
};
}
// Parses ATT&CK config schema into data suitable for react-table (ATT&CK matrix)
static parseTechniques(data, maxLen) {
@ -47,7 +47,7 @@ class MatrixComponent extends AuthComponent {
techniques.push(row)
}
return techniques;
};
}
getColumns(matrixData) {
return Object.keys(matrixData[0]).map((key) => {
@ -73,7 +73,7 @@ class MatrixComponent extends AuthComponent {
</Checkbox>
</Tooltip>)
}
};
}
getTableData = (config) => {
let configCopy = JSON.parse(JSON.stringify(config));
@ -106,7 +106,7 @@ class MatrixComponent extends AuthComponent {
return (
<div>
{this.renderLegend()}
<div className={"attack-matrix"}>
<div className={'attack-matrix'}>
<ReactTable columns={tableData['columns']}
data={tableData['matrixTableData']}
showPagination={false}

View File

@ -1,24 +1,24 @@
import React from "react";
import React from 'react';
export function renderMachine(val) {
return (
<span>{val.ip_addr} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")}</span>
<span>{val.ip_addr} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')}</span>
)
}
/* Function takes data gathered from system info collector and creates a
string representation of machine from that data. */
export function renderMachineFromSystemData(data) {
let machineStr = data['hostname'] + " ( ";
let machineStr = data['hostname'] + ' ( ';
data['ips'].forEach(function (ipInfo) {
if (typeof ipInfo === "object") {
machineStr += ipInfo['addr'] + ", ";
if (typeof ipInfo === 'object') {
machineStr += ipInfo['addr'] + ', ';
} else {
machineStr += ipInfo + ", ";
machineStr += ipInfo + ', ';
}
});
// Replaces " ," with " )" to finish a list of IP's
return machineStr.slice(0, -2) + " )"
return machineStr.slice(0, -2) + ' )'
}
/* Formats telemetry data that contains _id.machine and _id.usage fields into columns

View File

@ -1,8 +1,8 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import '../../report-components/security/StolenPasswords'
import StolenPasswordsComponent from "../../report-components/security/StolenPasswords";
import {ScanStatus} from "./Helpers"
import StolenPasswordsComponent from '../../report-components/security/StolenPasswords';
import {ScanStatus} from './Helpers'
class T1003 extends React.Component {
@ -19,7 +19,7 @@ class T1003 extends React.Component {
{this.props.data.status === ScanStatus.USED ?
<StolenPasswordsComponent
data={this.props.reportData.glance.stolen_creds.concat(this.props.reportData.glance.ssh_keys)}/>
: ""}
: ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, ScanStatus} from "./Helpers";
import ReactTable from 'react-table';
import {renderMachineFromSystemData, ScanStatus} from './Helpers';
class T1005 extends React.Component {
@ -11,7 +11,7 @@ class T1005 extends React.Component {
static getDataColumns() {
return ([{
Header: "Sensitive data",
Header: 'Sensitive data',
columns: [
{
Header: 'Machine',
@ -20,10 +20,10 @@ class T1005 extends React.Component {
style: {'whiteSpace': 'unset'}
},
{Header: 'Type', id: 'type', accessor: x => x.gathered_data_type, style: {'whiteSpace': 'unset'}},
{Header: 'Info', id: 'info', accessor: x => x.info, style: {'whiteSpace': 'unset'}},
{Header: 'Info', id: 'info', accessor: x => x.info, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -36,7 +36,7 @@ class T1005 extends React.Component {
data={this.props.data.collected_data}
showPagination={false}
defaultPageSize={this.props.data.collected_data.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from './Helpers'
class T1016 extends React.Component {
@ -12,7 +12,7 @@ class T1016 extends React.Component {
static getNetworkInfoColumns() {
return ([{
Header: "Network configuration info gathered",
Header: 'Network configuration info gathered',
columns: [
{
Header: 'Machine',
@ -20,10 +20,10 @@ class T1016 extends React.Component {
accessor: x => renderMachineFromSystemData(x.machine),
style: {'whiteSpace': 'unset'}
},
{Header: 'Network info', id: 'info', accessor: x => renderUsageFields(x.info), style: {'whiteSpace': 'unset'}},
{Header: 'Network info', id: 'info', accessor: x => renderUsageFields(x.info), style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -36,7 +36,7 @@ class T1016 extends React.Component {
data={this.props.data.network_info}
showPagination={false}
defaultPageSize={this.props.data.network_info.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, renderMachine, ScanStatus} from './Helpers'
class T1018 extends React.Component {
@ -34,10 +34,10 @@ class T1018 extends React.Component {
id: 'systems',
accessor: x => T1018.renderMachines(x.machines),
style: {'whiteSpace': 'unset'}
},
}
]
}])
};
}
render() {
return (
@ -50,7 +50,7 @@ class T1018 extends React.Component {
data={this.props.data.scan_info}
showPagination={false}
defaultPageSize={this.props.data.scan_info.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1021 extends React.Component {
@ -23,14 +23,14 @@ class T1021 extends React.Component {
id: 'credentials',
accessor: x => this.renderCreds(x.successful_creds),
style: {'whiteSpace': 'unset'}
},
}
]
}])
};
}
static renderCreds(creds) {
return <span>{creds.map(cred => <div key={cred}>{cred}</div>)}</span>
};
}
render() {
return (
@ -43,7 +43,7 @@ class T1021 extends React.Component {
data={this.props.data.services}
showPagination={false}
defaultPageSize={this.props.data.services.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {getUsageColumns} from "./Helpers"
import ReactTable from 'react-table';
import {getUsageColumns} from './Helpers'
class T1035 extends React.Component {
@ -21,7 +21,7 @@ class T1035 extends React.Component {
data={this.props.data.services}
showPagination={false}
defaultPageSize={this.props.data.services.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {ScanStatus} from "./Helpers";
import ReactTable from 'react-table';
import {ScanStatus} from './Helpers';
class T1041 extends React.Component {
@ -11,13 +11,13 @@ class T1041 extends React.Component {
static getC2Columns() {
return ([{
Header: "Data exfiltration channels",
Header: 'Data exfiltration channels',
columns: [
{Header: 'Source', id: 'src', accessor: x => x.src, style: {'whiteSpace': 'unset'}},
{Header: 'Destination', id: 'dst', accessor: x => x.dst, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -30,7 +30,7 @@ class T1041 extends React.Component {
data={this.props.data.command_control_channel}
showPagination={false}
defaultPageSize={this.props.data.command_control_channel.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1059 extends React.Component {
@ -22,10 +22,10 @@ class T1059 extends React.Component {
width: 160
},
{Header: 'Approx. Time', id: 'time', accessor: x => x.data.info.finished, style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.data.info.executed_cmds.cmd, style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.data.info.executed_cmds.cmd, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -38,7 +38,7 @@ class T1059 extends React.Component {
data={this.props.data.cmds}
showPagination={false}
defaultPageSize={this.props.data.cmds.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {getUsageColumns} from "./Helpers"
import ReactTable from 'react-table';
import {getUsageColumns} from './Helpers'
class T1064 extends React.Component {
@ -21,7 +21,7 @@ class T1064 extends React.Component {
data={this.props.data.scripts}
showPagination={false}
defaultPageSize={this.props.data.scripts.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1075 extends React.Component {
@ -12,9 +12,9 @@ class T1075 extends React.Component {
}
setLoginHashType(login) {
if (login.attempts[0].ntlm_hash !== "") {
if (login.attempts[0].ntlm_hash !== '') {
login.attempts[0].hashType = 'NTLM';
} else if (login.attempts[0].lm_hash !== "") {
} else if (login.attempts[0].lm_hash !== '') {
login.attempts[0].hashType = 'LM';
}
}
@ -25,10 +25,10 @@ class T1075 extends React.Component {
{Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), style: {'whiteSpace': 'unset'}},
{Header: 'Service', id: 'service', accessor: x => x.info.display_name, style: {'whiteSpace': 'unset'}},
{Header: 'Username', id: 'username', accessor: x => x.attempts[0].user, style: {'whiteSpace': 'unset'}},
{Header: 'Hash type', id: 'hash', accessor: x => x.attempts[0].hashType, style: {'whiteSpace': 'unset'}},
{Header: 'Hash type', id: 'hash', accessor: x => x.attempts[0].hashType, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -41,7 +41,7 @@ class T1075 extends React.Component {
data={this.props.data.successful_logins}
showPagination={false}
defaultPageSize={this.props.data.successful_logins.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, renderUsageFields, ScanStatus} from './Helpers'
class T1082 extends React.Component {
@ -19,10 +19,10 @@ class T1082 extends React.Component {
accessor: x => renderMachineFromSystemData(x.machine),
style: {'whiteSpace': 'unset'}
},
{Header: 'Gathered info', id: 'info', accessor: x => renderUsageFields(x.collections), style: {'whiteSpace': 'unset'}},
{Header: 'Gathered info', id: 'info', accessor: x => renderUsageFields(x.collections), style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -35,7 +35,7 @@ class T1082 extends React.Component {
data={this.props.data.system_info}
showPagination={false}
defaultPageSize={this.props.data.system_info.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1086 extends React.Component {
@ -22,10 +22,10 @@ class T1086 extends React.Component {
width: 160
},
{Header: 'Approx. Time', id: 'time', accessor: x => x.data[0].info.finished, style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds[0].cmd, style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.data[0].info.executed_cmds[0].cmd, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -38,7 +38,7 @@ class T1086 extends React.Component {
data={this.props.data.cmds}
showPagination={false}
defaultPageSize={this.props.data.cmds.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, ScanStatus} from './Helpers'
class T1090 extends React.Component {
@ -20,7 +20,7 @@ class T1090 extends React.Component {
style: {'whiteSpace': 'unset', textAlign: 'center'}
}]
}])
};
}
render() {
return (
@ -33,7 +33,7 @@ class T1090 extends React.Component {
data={this.props.data.proxies}
showPagination={false}
defaultPageSize={this.props.data.proxies.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {ScanStatus} from './Helpers'
class T1105 extends React.Component {
@ -16,10 +16,10 @@ class T1105 extends React.Component {
columns: [
{Header: 'Src. Machine', id: 'srcMachine', accessor: x => x.src, style: {'whiteSpace': 'unset'}, width: 170},
{Header: 'Dst. Machine', id: 'dstMachine', accessor: x => x.dst, style: {'whiteSpace': 'unset'}, width: 170},
{Header: 'Filename', id: 'filename', accessor: x => x.filename, style: {'whiteSpace': 'unset'}},
{Header: 'Filename', id: 'filename', accessor: x => x.filename, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -32,7 +32,7 @@ class T1105 extends React.Component {
data={this.props.data.files}
showPagination={false}
defaultPageSize={this.props.data.files.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {getUsageColumns} from "./Helpers"
import ReactTable from 'react-table';
import {getUsageColumns} from './Helpers'
class T1106 extends React.Component {
@ -21,7 +21,7 @@ class T1106 extends React.Component {
data={this.props.data.api_uses}
showPagination={false}
defaultPageSize={this.props.data.api_uses.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, ScanStatus} from './Helpers'
class T1107 extends React.Component {
@ -33,7 +33,7 @@ class T1107 extends React.Component {
style: {'whiteSpace': 'unset'}, width: 160
}]
}])
};
}
render() {
return (
@ -46,7 +46,7 @@ class T1107 extends React.Component {
data={this.props.data.deleted_files}
showPagination={false}
defaultPageSize={this.props.data.deleted_files.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1110 extends React.Component {
@ -26,14 +26,14 @@ class T1110 extends React.Component {
id: 'credentials',
accessor: x => this.renderCreds(x.successful_creds),
style: {'whiteSpace': 'unset'}
},
}
]
}])
};
}
static renderCreds(creds) {
return <span>{creds.map(cred => <div key={cred}>{cred}</div>)}</span>
};
}
render() {
return (
@ -46,7 +46,7 @@ class T1110 extends React.Component {
data={this.props.data.services}
showPagination={false}
defaultPageSize={this.props.data.services.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {getUsageColumns} from "./Helpers";
import ReactTable from 'react-table';
import {getUsageColumns} from './Helpers';
class T1129 extends React.Component {
@ -20,7 +20,7 @@ class T1129 extends React.Component {
data={this.props.data.dlls}
showPagination={false}
defaultPageSize={this.props.data.dlls.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, ScanStatus} from './Helpers'
class T1145 extends React.Component {
@ -33,10 +33,10 @@ class T1145 extends React.Component {
id: 'keys',
accessor: x => T1145.renderSSHKeys(x.ssh_info),
style: {'whiteSpace': 'unset'}
},
}
]
}])
};
}
render() {
return (
@ -49,7 +49,7 @@ class T1145 extends React.Component {
data={this.props.data.ssh_info}
showPagination={false}
defaultPageSize={this.props.data.ssh_info.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachineFromSystemData, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachineFromSystemData, ScanStatus} from './Helpers'
class T1188 extends React.Component {
@ -12,7 +12,7 @@ class T1188 extends React.Component {
static getHopColumns() {
return ([{
Header: "Communications through multi-hop proxies",
Header: 'Communications through multi-hop proxies',
columns: [
{
Header: 'From',
@ -31,10 +31,10 @@ class T1188 extends React.Component {
id: 'hops',
accessor: x => x.count,
style: {'whiteSpace': 'unset'}
},
}
]
}])
};
}
render() {
return (
@ -47,7 +47,7 @@ class T1188 extends React.Component {
data={this.props.data.hops}
showPagination={false}
defaultPageSize={this.props.data.hops.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine} from './Helpers'
class T1210 extends React.Component {

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine} from './Helpers'
class T1210 extends React.Component {
@ -12,7 +12,7 @@ class T1210 extends React.Component {
static getScanColumns() {
return ([{
Header: "Found services",
Header: 'Found services',
columns: [
{
Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine),
@ -27,7 +27,7 @@ class T1210 extends React.Component {
static getExploitColumns() {
return ([{
Header: "Exploited services",
Header: 'Exploited services',
columns: [
{
Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine),
@ -41,13 +41,13 @@ class T1210 extends React.Component {
{Header: 'Service', id: 'service', accessor: x => x.service.display_name, style: {'whiteSpace': 'unset'}}
]
}])
};
}
static renderEndpoint(val) {
return (
<span>{(val.vulnerable_urls.length !== 0 ? val.vulnerable_urls[0] : val.vulnerable_ports[0])}</span>
)
};
}
static formatScanned(data) {
let result = [];
@ -63,7 +63,7 @@ class T1210 extends React.Component {
result.push(scanned_service)
}
return result
};
}
renderScannedServices(data) {
return (

View File

@ -1,7 +1,7 @@
import React from 'react';
import '../../../styles/Collapse.scss'
import ReactTable from "react-table";
import {renderMachine, ScanStatus} from "./Helpers"
import ReactTable from 'react-table';
import {renderMachine, ScanStatus} from './Helpers'
class T1222 extends React.Component {
@ -12,13 +12,13 @@ class T1222 extends React.Component {
static getCommandColumns() {
return ([{
Header: "Permission modification commands",
Header: 'Permission modification commands',
columns: [
{Header: 'Machine', id: 'machine', accessor: x => renderMachine(x.machine), style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.command, style: {'whiteSpace': 'unset'}},
{Header: 'Command', id: 'command', accessor: x => x.command, style: {'whiteSpace': 'unset'}}
]
}])
};
}
render() {
return (
@ -31,7 +31,7 @@ class T1222 extends React.Component {
data={this.props.data.commands}
showPagination={false}
defaultPageSize={this.props.data.commands.length}
/> : ""}
/> : ''}
</div>
);
}

View File

@ -84,14 +84,14 @@ class InfMapPreviewPaneComponent extends PreviewPaneComponent {
unescapeLog(st) {
return st.substr(1, st.length - 2) // remove quotation marks on beginning and end of string.
.replace(/\\n/g, "\n")
.replace(/\\r/g, "\r")
.replace(/\\t/g, "\t")
.replace(/\\b/g, "\b")
.replace(/\\f/g, "\f")
.replace(/\\n/g, '\n')
.replace(/\\r/g, '\r')
.replace(/\\t/g, '\t')
.replace(/\\b/g, '\b')
.replace(/\\f/g, '\f')
.replace(/\\"/g, '\"')
.replace(/\\'/g, "\'")
.replace(/\\&/g, "\&");
.replace(/\\'/g, '\'')
.replace(/\\&/g, '\&');
}
downloadLog(asset) {

View File

@ -92,14 +92,14 @@ class PreviewPaneComponent extends AuthComponent {
unescapeLog(st) {
return st.substr(1, st.length - 2) // remove quotation marks on beginning and end of string.
.replace(/\\n/g, "\n")
.replace(/\\r/g, "\r")
.replace(/\\t/g, "\t")
.replace(/\\b/g, "\b")
.replace(/\\f/g, "\f")
.replace(/\\n/g, '\n')
.replace(/\\r/g, '\r')
.replace(/\\t/g, '\t')
.replace(/\\b/g, '\b')
.replace(/\\f/g, '\f')
.replace(/\\"/g, '\"')
.replace(/\\'/g, "\'")
.replace(/\\&/g, "\&");
.replace(/\\'/g, '\'')
.replace(/\\&/g, '\&');
}
downloadLog(asset) {

View File

@ -5,7 +5,7 @@ import FileSaver from 'file-saver';
import AuthComponent from '../AuthComponent';
import {FilePond} from 'react-filepond';
import 'filepond/dist/filepond.min.css';
import MatrixComponent from "../attack/MatrixComponent";
import MatrixComponent from '../attack/MatrixComponent';
const ATTACK_URL = '/api/attack';
const CONFIG_URL = '/api/configuration/island';
@ -39,31 +39,31 @@ class ConfigurePageComponent extends AuthComponent {
getUiSchemas() {
return ({
basic: {"ui:order": ["general", "credentials"]},
basic: {'ui:order': ['general', 'credentials']},
basic_network: {},
monkey: {
behaviour: {
custom_PBA_linux_cmd: {
"ui:widget": "textarea",
"ui:emptyValue": ""
'ui:widget': 'textarea',
'ui:emptyValue': ''
},
PBA_linux_file: {
"ui:widget": this.PBAlinux
'ui:widget': this.PBAlinux
},
custom_PBA_windows_cmd: {
"ui:widget": "textarea",
"ui:emptyValue": ""
'ui:widget': 'textarea',
'ui:emptyValue': ''
},
PBA_windows_file: {
"ui:widget": this.PBAwindows
'ui:widget': this.PBAwindows
},
PBA_linux_filename: {
classNames: "linux-pba-file-info",
"ui:emptyValue": ""
classNames: 'linux-pba-file-info',
'ui:emptyValue': ''
},
PBA_windows_filename: {
classNames: "windows-pba-file-info",
"ui:emptyValue": ""
classNames: 'windows-pba-file-info',
'ui:emptyValue': ''
}
}
},
@ -95,7 +95,7 @@ class ConfigurePageComponent extends AuthComponent {
this.setInitialAttackConfig(attackConfig.configuration);
for (let sectionKey of this.sectionsOrder) {
if (sectionKey === 'attack') {
sections.push({key: sectionKey, title: "ATT&CK"})
sections.push({key: sectionKey, title: 'ATT&CK'})
} else {
sections.push({key: sectionKey, title: monkeyConfig.schema.properties[sectionKey].title});
}
@ -148,6 +148,7 @@ class ConfigurePageComponent extends AuthComponent {
.then(this.updateConfig())
.then(this.setState({lastAction: 'saved'}))
.catch(error => {
console.log('Bad configuration: ' + error.toString());
this.setState({lastAction: 'invalid_configuration'});
});
};
@ -166,8 +167,8 @@ class ConfigurePageComponent extends AuthComponent {
this.setInitialConfig(res.configuration);
this.props.onStatusChange();
}).catch(error => {
console.log('bad configuration');
this.setState({lastAction: 'invalid_configuration'});
console.log('Bad configuration: ' + error.toString());
this.setState({lastAction: 'invalid_configuration'});
});
};
@ -327,8 +328,8 @@ class ConfigurePageComponent extends AuthComponent {
exportConfig = () => {
this.updateConfigSection();
const configAsJson = JSON.stringify(this.state.configuration, null, 2);
const configAsBinary = new Blob([configAsJson], {type: "text/plain;charset=utf-8"});
const configAsBinary = new Blob([configAsJson], {type: 'text/plain;charset=utf-8'});
FileSaver.saveAs(configAsBinary, 'monkey.conf');
};
@ -349,7 +350,7 @@ class ConfigurePageComponent extends AuthComponent {
console.log('bad configuration');
this.setState({lastAction: 'invalid_configuration'});
}));
};
}
importConfig = (event) => {
let reader = new FileReader();
@ -464,7 +465,7 @@ class ConfigurePageComponent extends AuthComponent {
formData={this.state.configuration[this.state.selectedSection]}
onChange={this.onChange}
noValidate={true}>
<button type="submit" className={"hidden"}>Submit</button>
<button type="submit" className={'hidden'}>Submit</button>
</Form>
</div>)
};

View File

@ -43,7 +43,7 @@ class MapPageComponent extends AuthComponent {
this.authFetch('/api/netmap')
.then(res => res.json())
.then(res => {
if (res.hasOwnProperty("edges")) {
if (res.hasOwnProperty('edges')) {
res.edges.forEach(edge => {
edge.color = {'color': edgeGroupToColor(edge.group)};
});

View File

@ -1,12 +1,8 @@
import React from 'react';
import {ReactiveGraph} from 'components/reactive-graph/ReactiveGraph';
import AuthComponent from '../AuthComponent';
import {optionsPth, edgeGroupToColorPth, options} from '../map/MapOptions';
import PreviewPane from "../map/preview-pane/PreviewPane";
import {Col} from "react-bootstrap";
import {Link} from 'react-router-dom';
import {Icon} from 'react-fa';
import PthPreviewPaneComponent from "../map/preview-pane/PthPreviewPane";
import {optionsPth} from '../map/MapOptions';
import {Col} from 'react-bootstrap';
class PassTheHashMapPageComponent extends AuthComponent {
constructor(props) {

View File

@ -9,16 +9,16 @@ import StolenPasswords from 'components/report-components/security/StolenPasswor
import CollapsibleWellComponent from 'components/report-components/security/CollapsibleWell';
import {Line} from 'rc-progress';
import AuthComponent from '../AuthComponent';
import PassTheHashMapPageComponent from "./PassTheHashMapPage";
import StrongUsers from "components/report-components/security/StrongUsers";
import AttackReport from "components/report-components/security/AttackReport";
import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader";
import MonkeysStillAliveWarning from "../report-components/common/MonkeysStillAliveWarning";
import ReportLoader from "../report-components/common/ReportLoader";
import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning";
import SecurityIssuesGlance from "../report-components/common/SecurityIssuesGlance";
import PrintReportButton from "../report-components/common/PrintReportButton";
import {extractExecutionStatusFromServerResponse} from "../report-components/common/ExecutionStatus";
import PassTheHashMapPageComponent from './PassTheHashMapPage';
import StrongUsers from 'components/report-components/security/StrongUsers';
import AttackReport from 'components/report-components/security/AttackReport';
import ReportHeader, {ReportTypes} from '../report-components/common/ReportHeader';
import MonkeysStillAliveWarning from '../report-components/common/MonkeysStillAliveWarning';
import ReportLoader from '../report-components/common/ReportLoader';
import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning';
import SecurityIssuesGlance from '../report-components/common/SecurityIssuesGlance';
import PrintReportButton from '../report-components/common/PrintReportButton';
import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus';
let guardicoreLogoImage = require('../../images/guardicore-logo.png');
@ -858,8 +858,8 @@ class ReportPageComponent extends AuthComponent {
className="label label-danger">remote code execution</span> attacks.
<br/>
The attack was made possible due to one of the following vulnerabilities:
<a href={"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10271"}> CVE-2017-10271</a> or
<a href={"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-2725"}> CVE-2019-2725</a>
<a href={'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10271'}> CVE-2017-10271</a> or
<a href={'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-2725'}> CVE-2019-2725</a>
</CollapsibleWellComponent>
</li>
);

View File

@ -7,7 +7,7 @@ import GridLoader from 'react-spinners/GridLoader';
import {Icon} from 'react-fa';
import {Link} from 'react-router-dom';
import AuthComponent from '../AuthComponent';
import AwsRunTable from "../run-monkey/AwsRunTable";
import AwsRunTable from '../run-monkey/AwsRunTable';
const loading_css_override = css`
display: block;
@ -348,7 +348,7 @@ class RunMonkeyPageComponent extends AuthComponent {
<div className='sweet-loading'>
<GridLoader
css={loading_css_override}
sizeUnit={"px"}
sizeUnit={'px'}
size={30}
color={'#ffcc00'}
loading={this.state.loading}

View File

@ -33,7 +33,7 @@ class TelemetryPageComponent extends AuthComponent {
this.authFetch('/api/log/island/download')
.then(res => res.json())
.then(res => {
let filename = 'Island_log'
let filename = 'Island_log';
let logContent = (res['log_file']);
download(logContent, filename, 'text/plain');
});

View File

@ -1,14 +1,14 @@
import React, {Fragment} from 'react';
import {Col} from 'react-bootstrap';
import AuthComponent from '../AuthComponent';
import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader";
import ReportLoader from "../report-components/common/ReportLoader";
import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning";
import PrintReportButton from "../report-components/common/PrintReportButton";
import {extractExecutionStatusFromServerResponse} from "../report-components/common/ExecutionStatus";
import SummarySection from "../report-components/zerotrust/SummarySection";
import FindingsSection from "../report-components/zerotrust/FindingsSection";
import PrinciplesSection from "../report-components/zerotrust/PrinciplesSection";
import ReportHeader, {ReportTypes} from '../report-components/common/ReportHeader';
import ReportLoader from '../report-components/common/ReportLoader';
import MustRunMonkeyWarning from '../report-components/common/MustRunMonkeyWarning';
import PrintReportButton from '../report-components/common/PrintReportButton';
import {extractExecutionStatusFromServerResponse} from '../report-components/common/ExecutionStatus';
import SummarySection from '../report-components/zerotrust/SummarySection';
import FindingsSection from '../report-components/zerotrust/FindingsSection';
import PrinciplesSection from '../report-components/zerotrust/PrinciplesSection';
class ZeroTrustReportPageComponent extends AuthComponent {
@ -100,13 +100,12 @@ class ZeroTrustReportPageComponent extends AuthComponent {
}
stillLoadingDataFromServer() {
return typeof this.state.findings === "undefined"
|| typeof this.state.pillars === "undefined"
|| typeof this.state.principles === "undefined";
return typeof this.state.findings === 'undefined'
|| typeof this.state.pillars === 'undefined'
|| typeof this.state.principles === 'undefined';
}
getZeroTrustReportFromServer() {
let res;
this.authFetch('/api/report/zero_trust/findings')
.then(res => res.json())
.then(res => {

View File

@ -1,5 +1,5 @@
import React, {Component} from "react";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import * as PropTypes from 'prop-types';
export default class MonkeysStillAliveWarning extends Component {
render() {

View File

@ -1,5 +1,5 @@
import React, {Component} from "react";
import {NavLink} from "react-router-dom";
import React, {Component} from 'react';
import {NavLink} from 'react-router-dom';
export default class MustRunMonkeyWarning extends Component {
render() {

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import ReactTable from "react-table";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import ReactTable from 'react-table';
import * as PropTypes from 'prop-types';
class PaginatedTable extends Component {
render() {
@ -31,5 +31,5 @@ export default PaginatedTable;
PaginatedTable.propTypes = {
data: PropTypes.array,
columns: PropTypes.array,
pageSize: PropTypes.number,
pageSize: PropTypes.number
};

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import {Button} from "react-bootstrap";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {Button} from 'react-bootstrap';
import * as PropTypes from 'prop-types';
export default class PrintReportButton extends Component {
render() {

View File

@ -1,13 +1,13 @@
import React, {Component} from "react";
import {Col} from "react-bootstrap";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {Col} from 'react-bootstrap';
import * as PropTypes from 'prop-types';
let monkeyLogoImage = require('../../../images/monkey-icon.svg');
export const ReportTypes = {
zeroTrust: "Zero Trust",
security: "Security",
null: ""
zeroTrust: 'Zero Trust',
security: 'Security',
null: ''
};
export class ReportHeader extends Component {
@ -41,5 +41,5 @@ export class ReportHeader extends Component {
export default ReportHeader;
ReportHeader.propTypes = {
report_type: PropTypes.string,
report_type: PropTypes.string
};

View File

@ -1,7 +1,7 @@
import {css} from "@emotion/core";
import React, {Component} from "react";
import {GridLoader} from "react-spinners";
import * as PropTypes from "prop-types";
import {css} from '@emotion/core';
import React, {Component} from 'react';
import {GridLoader} from 'react-spinners';
import * as PropTypes from 'prop-types';
const loading_css_override = css`
display: block;
@ -16,7 +16,7 @@ export default class ReportLoader extends Component {
<h1>Generating Report...</h1>
<GridLoader
css={loading_css_override}
sizeUnit={"px"}
sizeUnit={'px'}
size={20}
color={'#ffcc00'}
loading={this.props.loading}

View File

@ -1,5 +1,5 @@
import React, {Component, Fragment} from "react";
import * as PropTypes from "prop-types";
import React, {Component, Fragment} from 'react';
import * as PropTypes from 'prop-types';
export default class SecurityIssuesGlance extends Component {
render() {

View File

@ -4,34 +4,34 @@ import {ReactiveGraph} from 'components/reactive-graph/ReactiveGraph';
import {edgeGroupToColor, options} from 'components/map/MapOptions';
import '../../../styles/Collapse.scss';
import AuthComponent from '../../AuthComponent';
import {ScanStatus} from "../../attack/techniques/Helpers";
import {ScanStatus} from '../../attack/techniques/Helpers';
import Collapse from '@kunukn/react-collapse';
import T1210 from '../../attack/techniques/T1210';
import T1197 from '../../attack/techniques/T1197';
import T1110 from '../../attack/techniques/T1110';
import T1075 from "../../attack/techniques/T1075";
import T1003 from "../../attack/techniques/T1003";
import T1059 from "../../attack/techniques/T1059";
import T1086 from "../../attack/techniques/T1086";
import T1082 from "../../attack/techniques/T1082";
import T1145 from "../../attack/techniques/T1145";
import T1105 from "../../attack/techniques/T1105";
import T1107 from "../../attack/techniques/T1107";
import T1065 from "../../attack/techniques/T1065";
import T1035 from "../../attack/techniques/T1035";
import T1129 from "../../attack/techniques/T1129";
import T1106 from "../../attack/techniques/T1106";
import T1188 from "../../attack/techniques/T1188";
import T1090 from "../../attack/techniques/T1090";
import T1041 from "../../attack/techniques/T1041";
import T1222 from "../../attack/techniques/T1222";
import T1005 from "../../attack/techniques/T1005";
import T1018 from "../../attack/techniques/T1018";
import T1016 from "../../attack/techniques/T1016";
import T1021 from "../../attack/techniques/T1021";
import T1064 from "../../attack/techniques/T1064";
import {extractExecutionStatusFromServerResponse} from "../common/ExecutionStatus";
import T1075 from '../../attack/techniques/T1075';
import T1003 from '../../attack/techniques/T1003';
import T1059 from '../../attack/techniques/T1059';
import T1086 from '../../attack/techniques/T1086';
import T1082 from '../../attack/techniques/T1082';
import T1145 from '../../attack/techniques/T1145';
import T1105 from '../../attack/techniques/T1105';
import T1107 from '../../attack/techniques/T1107';
import T1065 from '../../attack/techniques/T1065';
import T1035 from '../../attack/techniques/T1035';
import T1129 from '../../attack/techniques/T1129';
import T1106 from '../../attack/techniques/T1106';
import T1188 from '../../attack/techniques/T1188';
import T1090 from '../../attack/techniques/T1090';
import T1041 from '../../attack/techniques/T1041';
import T1222 from '../../attack/techniques/T1222';
import T1005 from '../../attack/techniques/T1005';
import T1018 from '../../attack/techniques/T1018';
import T1016 from '../../attack/techniques/T1016';
import T1021 from '../../attack/techniques/T1021';
import T1064 from '../../attack/techniques/T1064';
import {extractExecutionStatusFromServerResponse} from '../common/ExecutionStatus';
const tech_components = {
'T1210': T1210,
@ -115,11 +115,11 @@ class AttackReportPageComponent extends AuthComponent {
getTechniqueCollapse(tech_id) {
return (
<div key={tech_id} className={classNames("collapse-item", {"item--active": this.state.collapseOpen === tech_id})}>
<button className={classNames("btn-collapse", this.getComponentClass(tech_id))} onClick={() => this.onToggle(tech_id)}>
<div key={tech_id} className={classNames('collapse-item', {'item--active': this.state.collapseOpen === tech_id})}>
<button className={classNames('btn-collapse', this.getComponentClass(tech_id))} onClick={() => this.onToggle(tech_id)}>
<span>{this.state.report[tech_id].title}</span>
<span>
<i className={classNames("fa", this.state.collapseOpen === tech_id ? "fa-chevron-down" : "fa-chevron-up")}></i>
<i className={classNames('fa', this.state.collapseOpen === tech_id ? 'fa-chevron-down' : 'fa-chevron-up')}></i>
</span>
</button>
<Collapse

View File

@ -6,7 +6,7 @@ let renderArray = function (val) {
};
let renderIpAddresses = function (val) {
return <div>{renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")} </div>;
return <div>{renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')} </div>;
};
const columns = [

View File

@ -6,7 +6,7 @@ let renderArray = function (val) {
};
let renderIpAddresses = function (val) {
return <span> {renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")} </span>;
return <span> {renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')} </span>;
};
let renderMachine = function (data) {
@ -14,18 +14,18 @@ let renderMachine = function (data) {
};
let renderPbaResults = function (results) {
let pbaClass = "";
let pbaClass = '';
if (results[1]) {
pbaClass = "pba-success"
pbaClass = 'pba-success'
} else {
pbaClass = "pba-danger"
pbaClass = 'pba-danger'
}
return <div className={pbaClass}> {results[0]} </div>
};
const subColumns = [
{id: 'pba_name', Header: "Name", accessor: x => x.name, style: {'whiteSpace': 'unset'}, width: 160},
{id: 'pba_output', Header: "Output", accessor: x => renderPbaResults(x.result), style: {'whiteSpace': 'unset'}}
{id: 'pba_name', Header: 'Name', accessor: x => x.name, style: {'whiteSpace': 'unset'}, width: 160},
{id: 'pba_output', Header: 'Output', accessor: x => renderPbaResults(x.result), style: {'whiteSpace': 'unset'}}
];
let renderDetails = function (data) {
@ -36,7 +36,7 @@ let renderDetails = function (data) {
columns={subColumns}
defaultPageSize={defaultPageSize}
showPagination={showPagination}
style={{"backgroundColor": "#ededed"}}
style={{'backgroundColor': '#ededed'}}
/>
};
@ -57,8 +57,8 @@ class PostBreachComponent extends React.Component {
}
render() {
let pbaMachines = this.props.data.filter(function (value, index, arr) {
return (value.pba_results !== "None" && value.pba_results.length > 0);
let pbaMachines = this.props.data.filter(function (value) {
return (value.pba_results !== 'None' && value.pba_results.length > 0);
});
let defaultPageSize = pbaMachines.length > pageSize ? pageSize : pbaMachines.length;
let showPagination = pbaMachines > pageSize;

View File

@ -6,7 +6,7 @@ let renderArray = function (val) {
};
let renderIpAddresses = function (val) {
return <div>{renderArray(val.ip_addresses)} {(val.domain_name ? " (".concat(val.domain_name, ")") : "")} </div>;
return <div>{renderArray(val.ip_addresses)} {(val.domain_name ? ' ('.concat(val.domain_name, ')') : '')} </div>;
};
const columns = [

View File

@ -1,7 +1,7 @@
import React, {Component, Fragment} from "react";
import EventsModal from "./EventsModal";
import {Badge, Button} from "react-bootstrap";
import * as PropTypes from "prop-types";
import React, {Component, Fragment} from 'react';
import EventsModal from './EventsModal';
import {Badge, Button} from 'react-bootstrap';
import * as PropTypes from 'prop-types';
export default class EventsButton extends Component {
constructor(props) {
@ -23,7 +23,7 @@ export default class EventsButton extends Component {
return <Fragment>
<EventsModal events={this.props.events} showEvents={this.state.isShow} hideCallback={this.hide}
exportFilename={this.props.exportFilename}/>
<div className="text-center" style={{"display": "grid"}}>
<div className="text-center" style={{'display': 'grid'}}>
<Button className="btn btn-primary btn-lg" onClick={this.show}>
<i className="fa fa-list"/> Events {this.createEventsAmountBadge()}
</Button>
@ -32,12 +32,12 @@ export default class EventsButton extends Component {
}
createEventsAmountBadge() {
const eventsAmountBadgeContent = this.props.events.length > 9 ? "9+" : this.props.events.length;
const eventsAmountBadgeContent = this.props.events.length > 9 ? '9+' : this.props.events.length;
return <Badge>{eventsAmountBadgeContent}</Badge>;
}
}
EventsButton.propTypes = {
events: PropTypes.array,
exportFilename: PropTypes.string,
exportFilename: PropTypes.string
};

View File

@ -1,11 +1,11 @@
import React, {Component} from "react";
import {Badge, Modal} from "react-bootstrap";
import EventsTimeline from "./EventsTimeline";
import * as PropTypes from "prop-types";
import saveJsonToFile from "../../utils/SaveJsonToFile";
import EventsModalButtons from "./EventsModalButtons";
import React, {Component} from 'react';
import {Badge, Modal} from 'react-bootstrap';
import EventsTimeline from './EventsTimeline';
import * as PropTypes from 'prop-types';
import saveJsonToFile from '../../utils/SaveJsonToFile';
import EventsModalButtons from './EventsModalButtons';
import Pluralize from 'pluralize'
import {statusToLabelType} from "./StatusLabel";
import {statusToLabelType} from './StatusLabel';
export default class EventsModal extends Component {
constructor(props) {
@ -23,7 +23,7 @@ export default class EventsModal extends Component {
<hr/>
<p>
There {Pluralize('is', this.props.events.length)} {<div
className={"label label-primary"}>{this.props.events.length}</div>} {Pluralize('event', this.props.events.length)} associated
className={'label label-primary'}>{this.props.events.length}</div>} {Pluralize('event', this.props.events.length)} associated
with this finding.
</p>
{this.props.events.length > 5 ? this.renderButtons() : null}
@ -49,5 +49,5 @@ export default class EventsModal extends Component {
EventsModal.propTypes = {
showEvents: PropTypes.bool,
events: PropTypes.array,
hideCallback: PropTypes.func,
hideCallback: PropTypes.func
};

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import ExportEventsButton from "./ExportEventsButton";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import ExportEventsButton from './ExportEventsButton';
import * as PropTypes from 'prop-types';
export default class EventsModalButtons extends Component {
render() {

View File

@ -1,13 +1,13 @@
import React, {Component} from "react";
import {Timeline, TimelineEvent} from "react-event-timeline";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {Timeline, TimelineEvent} from 'react-event-timeline';
import * as PropTypes from 'prop-types';
let monkeyLocalIcon = require('../../../images/zerotrust/im-alert-machine-icon.svg');
let monkeyNetworkIcon = require('../../../images/zerotrust/im-alert-network-icon.svg');
const eventTypeToIcon = {
"monkey_local": monkeyLocalIcon,
"monkey_network": monkeyNetworkIcon,
'monkey_local': monkeyLocalIcon,
'monkey_network': monkeyNetworkIcon
};
export default class EventsTimeline extends Component {

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import {Button} from "react-bootstrap";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {Button} from 'react-bootstrap';
import * as PropTypes from 'prop-types';
export default class ExportEventsButton extends Component {
render() {

View File

@ -1,8 +1,8 @@
import React, {Component, Fragment} from "react";
import PillarLabel from "./PillarLabel";
import EventsButton from "./EventsButton";
import ZeroTrustPillars, {ZeroTrustStatuses} from "./ZeroTrustPillars";
import {FindingsTable} from "./FindingsTable";
import React, {Component, Fragment} from 'react';
import PillarLabel from './PillarLabel';
import EventsButton from './EventsButton';
import ZeroTrustPillars, {ZeroTrustStatuses} from './ZeroTrustPillars';
import {FindingsTable} from './FindingsTable';
class FindingsSection extends Component {

View File

@ -1,9 +1,9 @@
import React, {Component, Fragment} from "react";
import StatusLabel from "./StatusLabel";
import PaginatedTable from "../common/PaginatedTable";
import * as PropTypes from "prop-types";
import PillarLabel from "./PillarLabel";
import EventsButton from "./EventsButton";
import React, {Component, Fragment} from 'react';
import StatusLabel from './StatusLabel';
import PaginatedTable from '../common/PaginatedTable';
import * as PropTypes from 'prop-types';
import PillarLabel from './PillarLabel';
import EventsButton from './EventsButton';
const EVENTS_COLUMN_MAX_WIDTH = 160;
const PILLARS_COLUMN_MAX_WIDTH = 200;
@ -16,25 +16,25 @@ const columns = [
},
{
Header: 'Events', id: "events",
Header: 'Events', id: 'events',
accessor: x => {
return <EventsButton events={x.events} exportFilename={"Events_" + x.test_key}/>;
return <EventsButton events={x.events} exportFilename={'Events_' + x.test_key}/>;
},
maxWidth: EVENTS_COLUMN_MAX_WIDTH,
maxWidth: EVENTS_COLUMN_MAX_WIDTH
},
{
Header: 'Pillars', id: "pillars",
Header: 'Pillars', id: 'pillars',
accessor: x => {
const pillars = x.pillars;
const pillarLabels = pillars.map((pillar) =>
<PillarLabel key={pillar.name} pillar={pillar.name} status={pillar.status}/>
);
return <div style={{textAlign: "center"}}>{pillarLabels}</div>;
return <div style={{textAlign: 'center'}}>{pillarLabels}</div>;
},
maxWidth: PILLARS_COLUMN_MAX_WIDTH,
style: {'whiteSpace': 'unset'}
},
}
]
}
];
@ -43,7 +43,7 @@ const columns = [
export class FindingsTable extends Component {
render() {
return <Fragment>
<h3>{<span style={{display: "inline-block"}}><StatusLabel status={this.props.status} showText={true}/>
<h3>{<span style={{display: 'inline-block'}}><StatusLabel status={this.props.status} showText={true}/>
</span>} tests' findings</h3>
<PaginatedTable data={this.props.data} pageSize={10} columns={columns}/>
</Fragment>

View File

@ -1,20 +1,20 @@
import React, {Component} from "react";
import {statusToLabelType} from "./StatusLabel";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {statusToLabelType} from './StatusLabel';
import * as PropTypes from 'prop-types';
const pillarToIcon = {
"Data": "fa fa-database",
"People": "fa fa-user",
"Networks": "fa fa-wifi",
"Workloads": "fa fa-cloud",
"Devices": "fa fa-laptop",
"Visibility & Analytics": "fa fa-eye-slash",
"Automation & Orchestration": "fa fa-cogs",
'Data': 'fa fa-database',
'People': 'fa fa-user',
'Networks': 'fa fa-wifi',
'Workloads': 'fa fa-cloud',
'Devices': 'fa fa-laptop',
'Visibility & Analytics': 'fa fa-eye-slash',
'Automation & Orchestration': 'fa fa-cogs'
};
export default class PillarLabel extends Component {
render() {
const className = "label " + statusToLabelType[this.props.status];
const className = 'label ' + statusToLabelType[this.props.status];
return <div className={className} style={{margin: '2px', display: 'inline-block'}}><i
className={pillarToIcon[this.props.pillar]}/> {this.props.pillar}</div>
}
@ -22,5 +22,5 @@ export default class PillarLabel extends Component {
PillarLabel.propTypes = {
status: PropTypes.string,
pillar: PropTypes.string,
pillar: PropTypes.string
};

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import * as PropTypes from "prop-types";
import ResponsiveVennDiagram from "./venn-components/ResponsiveVennDiagram";
import React, {Component} from 'react';
import * as PropTypes from 'prop-types';
import ResponsiveVennDiagram from './venn-components/ResponsiveVennDiagram';
class PillarOverview extends Component {
render() {
@ -13,5 +13,5 @@ class PillarOverview extends Component {
export default PillarOverview;
PillarOverview.propTypes = {
grades: PropTypes.array,
grades: PropTypes.array
};

View File

@ -1,6 +1,6 @@
import React, {Component} from "react";
import SinglePillarPrinciplesStatus from "./SinglePillarPrinciplesStatus";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import SinglePillarPrinciplesStatus from './SinglePillarPrinciplesStatus';
import * as PropTypes from 'prop-types';
export default class PrinciplesSection extends Component {
render() {

View File

@ -1,9 +1,9 @@
import React, {Fragment} from "react";
import PaginatedTable from "../common/PaginatedTable";
import AuthComponent from "../../AuthComponent";
import StatusLabel from "./StatusLabel";
import * as PropTypes from "prop-types";
import {ZeroTrustStatuses} from "./ZeroTrustPillars";
import React, {Fragment} from 'react';
import PaginatedTable from '../common/PaginatedTable';
import AuthComponent from '../../AuthComponent';
import StatusLabel from './StatusLabel';
import * as PropTypes from 'prop-types';
import {ZeroTrustStatuses} from './ZeroTrustPillars';
const MAX_WIDTH_STATUS_COLUMN = 80;

View File

@ -1,8 +1,8 @@
import React, {Component} from "react";
import StatusLabel from "./StatusLabel";
import {ZeroTrustStatuses} from "./ZeroTrustPillars";
import {NavLink} from "react-router-dom";
import {Panel} from "react-bootstrap";
import React, {Component} from 'react';
import StatusLabel from './StatusLabel';
import {ZeroTrustStatuses} from './ZeroTrustPillars';
import {NavLink} from 'react-router-dom';
import {Panel} from 'react-bootstrap';
class ZeroTrustReportLegend extends Component {
@ -27,31 +27,31 @@ class ZeroTrustReportLegend extends Component {
getLegendContent() {
return <div id={this.constructor.name}>
<ul style={{listStyle: "none"}}>
<ul style={{listStyle: 'none'}}>
<li>
<div style={{display: "inline-block"}}>
<div style={{display: 'inline-block'}}>
<StatusLabel showText={true} status={ZeroTrustStatuses.failed}/>
</div>
{"\t"}At least one of the tests related to this component failed. This means that the Infection Monkey detected an
{'\t'}At least one of the tests related to this component failed. This means that the Infection Monkey detected an
unmet Zero Trust requirement.
</li>
<li>
<div style={{display: "inline-block"}}>
<div style={{display: 'inline-block'}}>
<StatusLabel showText={true} status={ZeroTrustStatuses.verify}/>
</div>
{"\t"}At least one of the tests results related to this component requires further manual verification.
{'\t'}At least one of the tests results related to this component requires further manual verification.
</li>
<li>
<div style={{display: "inline-block"}}>
<div style={{display: 'inline-block'}}>
<StatusLabel showText={true} status={ZeroTrustStatuses.passed}/>
</div>
{"\t"}All Tests related to this pillar passed. No violation of a Zero Trust guiding principle was detected.
{'\t'}All Tests related to this pillar passed. No violation of a Zero Trust guiding principle was detected.
</li>
<li>
<div style={{display: "inline-block"}}>
<div style={{display: 'inline-block'}}>
<StatusLabel showText={true} status={ZeroTrustStatuses.unexecuted}/>
</div>
{"\t"}This status means the test wasn't executed.To activate more tests, refer to the Monkey <NavLink
{'\t'}This status means the test wasn't executed.To activate more tests, refer to the Monkey <NavLink
to="/configuration"><u>configuration</u></NavLink> page.
</li>
</ul>

View File

@ -1,9 +1,9 @@
import AuthComponent from "../../AuthComponent";
import PillarLabel from "./PillarLabel";
import PrinciplesStatusTable from "./PrinciplesStatusTable";
import React from "react";
import * as PropTypes from "prop-types";
import {Panel} from "react-bootstrap";
import AuthComponent from '../../AuthComponent';
import PillarLabel from './PillarLabel';
import PrinciplesStatusTable from './PrinciplesStatusTable';
import React from 'react';
import * as PropTypes from 'prop-types';
import {Panel} from 'react-bootstrap';
export default class SinglePillarPrinciplesStatus extends AuthComponent {
render() {
@ -14,7 +14,7 @@ export default class SinglePillarPrinciplesStatus extends AuthComponent {
<Panel>
<Panel.Heading>
<Panel.Title toggle>
<h3 style={{textAlign: "center", marginTop: "1px", marginBottom: "1px"}}>
<h3 style={{textAlign: 'center', marginTop: '1px', marginBottom: '1px'}}>
<i className="fa fa-chevron-down"/> <PillarLabel pillar={this.props.pillar}
status={this.props.pillarsToStatuses[this.props.pillar]}/>
</h3>
@ -33,5 +33,5 @@ export default class SinglePillarPrinciplesStatus extends AuthComponent {
SinglePillarPrinciplesStatus.propTypes = {
principlesStatus: PropTypes.array,
pillar: PropTypes.string,
pillar: PropTypes.string
};

View File

@ -1,30 +1,30 @@
import React, {Component} from "react";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import * as PropTypes from 'prop-types';
const statusToIcon = {
"Passed": "fa-check",
"Verify": "fa-exclamation-triangle",
"Failed": "fa-bomb",
"Unexecuted": "fa-question",
'Passed': 'fa-check',
'Verify': 'fa-exclamation-triangle',
'Failed': 'fa-bomb',
'Unexecuted': 'fa-question'
};
export const statusToLabelType = {
"Passed": "label-success",
"Verify": "label-warning",
"Failed": "label-danger",
"Unexecuted": "label-default",
'Passed': 'label-success',
'Verify': 'label-warning',
'Failed': 'label-danger',
'Unexecuted': 'label-default'
};
export default class StatusLabel extends Component {
render() {
let text = "";
let text = '';
if (this.props.showText) {
text = " " + this.props.status;
text = ' ' + this.props.status;
}
return (
<div className={"label " + statusToLabelType[this.props.status]} style={{display: "flow-root"}}>
<i className={"fa " + statusToIcon[this.props.status] + " " + this.props.size}/>{text}
<div className={'label ' + statusToLabelType[this.props.status]} style={{display: 'flow-root'}}>
<i className={'fa ' + statusToIcon[this.props.status] + ' ' + this.props.size}/>{text}
</div>
);
}

View File

@ -1,8 +1,8 @@
import React, {Component, Fragment} from "react";
import PillarLabel from "./PillarLabel";
import StatusLabel from "./StatusLabel";
import * as PropTypes from "prop-types";
import {ZeroTrustStatuses} from "./ZeroTrustPillars";
import React, {Component, Fragment} from 'react';
import PillarLabel from './PillarLabel';
import StatusLabel from './StatusLabel';
import * as PropTypes from 'prop-types';
import {ZeroTrustStatuses} from './ZeroTrustPillars';
export default class StatusesToPillarsSummary extends Component {
render() {

View File

@ -1,9 +1,9 @@
import React, {Component} from "react";
import {Col, Grid, Row} from "react-bootstrap";
import MonkeysStillAliveWarning from "../common/MonkeysStillAliveWarning";
import PillarsOverview from "./PillarOverview";
import ZeroTrustReportLegend from "./ReportLegend";
import * as PropTypes from "prop-types";
import React, {Component} from 'react';
import {Col, Grid, Row} from 'react-bootstrap';
import MonkeysStillAliveWarning from '../common/MonkeysStillAliveWarning';
import PillarsOverview from './PillarOverview';
import ZeroTrustReportLegend from './ReportLegend';
import * as PropTypes from 'prop-types';
export default class SummarySection extends Component {
render() {

View File

@ -1,18 +1,18 @@
export const ZeroTrustPillars = {
data: "Data",
people: "People",
network: "Networks",
workload: "Workload",
devices: "Devices",
visibility: "Visibility & Analytics",
automation: "Automation & Orchestration"
data: 'Data',
people: 'People',
network: 'Networks',
workload: 'Workload',
devices: 'Devices',
visibility: 'Visibility & Analytics',
automation: 'Automation & Orchestration'
};
export const ZeroTrustStatuses = {
failed: "Failed",
verify: "Verify",
passed: "Passed",
unexecuted: "Unexecuted"
failed: 'Failed',
verify: 'Verify',
passed: 'Passed',
unexecuted: 'Unexecuted'
};
export default ZeroTrustPillars;

View File

@ -41,17 +41,17 @@ class ArcNode extends React.Component {
}
handleClick(e_) {
handleClick() {
this.props.disableHover(this.refs.overlay);
}
handleOver(e_) {
handleOver() {
if (this.props.hover) {
this.refs.overlay.show();
}
}
handleOut(e_) {
handleOut() {
if (this.props.hover) {
this.refs.overlay.hide();
}

View File

@ -1,5 +1,5 @@
import React from 'react'
import PillarLabel from "../PillarLabel";
import PillarLabel from '../PillarLabel';
import {Popover, OverlayTrigger} from 'react-bootstrap';
import PropTypes from 'prop-types';
@ -38,17 +38,17 @@ class CircularNode extends React.Component {
}
handleClick(e_) {
handleClick() {
this.props.disableHover(this.refs.overlay);
}
handleOver(e_) {
handleOver() {
if (this.props.hover) {
this.refs.overlay.show();
}
}
handleOut(e_) {
handleOut() {
if (this.props.hover) {
this.refs.overlay.hide();
}

View File

@ -4,7 +4,7 @@ import CircularNode from './CircularNode'
import ArcNode from './ArcNode'
import {TypographicUtilities} from './Utility.js'
import './VennDiagram.css'
import {ZeroTrustStatuses} from "../ZeroTrustPillars";
import {ZeroTrustStatuses} from '../ZeroTrustPillars';
class VennDiagram extends React.Component {
constructor(props_) {
@ -131,16 +131,12 @@ class VennDiagram extends React.Component {
let self = this;
let hidden = 'none';
let html = '';
let bcolor = '#DEDEDE';
if (this.state.currentPopover !== undefined) {
this.state.currentPopover.show();
}
document.querySelectorAll('circle, path').forEach((d_, i_) => {
d_.setAttribute('opacity', "0.8");
document.querySelectorAll('circle, path').forEach((d_) => {
d_.setAttribute('opacity', '0.8');
});
if (e.target.id.includes('Node')) {
@ -175,10 +171,9 @@ class VennDiagram extends React.Component {
let data = [];
const omit = (prop, {[prop]: _, ...rest}) => rest;
this.props.pillarsGrades.forEach((d_, i_) => {
this.props.pillarsGrades.forEach((d_) => {
let params = omit('pillar', d_);
let sum = Object.keys(params).reduce((sum_, key_) => sum_ + parseFloat(params[key_] || 0), 0);
let key = TypographicUtilities.removeAmpersand(d_.pillar);
let html = self.buildTooltipHtmlContent(params);
let rule = null;

View File

@ -1,6 +1,6 @@
import React from 'react';
import ReactTable from 'react-table'
import checkboxHOC from "react-table/lib/hoc/selectTable";
import checkboxHOC from 'react-table/lib/hoc/selectTable';
const CheckboxTable = checkboxHOC(ReactTable);
@ -28,7 +28,7 @@ class AwsRunTableComponent extends React.Component {
}
}
toggleSelection = (key, shift, row) => {
toggleSelection = (key) => {
// start off with the existing state
let selection = [...this.state.selection];
const keyIndex = selection.indexOf(key);
@ -68,13 +68,13 @@ class AwsRunTableComponent extends React.Component {
};
getTrProps = (s, r) => {
let color = "inherit";
let color = 'inherit';
if (r) {
let instId = r.original.instance_id;
if (this.isSelected(instId)) {
color = "#ffed9f";
color = '#ffed9f';
} else if (this.state.result.hasOwnProperty(instId)) {
color = this.state.result[instId] ? "#00f01b" : '#f00000'
color = this.state.result[instId] ? '#00f01b' : '#f00000'
}
}

View File

@ -18,7 +18,7 @@ class VersionComponent extends React.Component {
this.setState({
currentVersion: res['current_version'],
newerVersion: res['newer_version'],
downloadLink: res['download_link'],
downloadLink: res['download_link']
});
});
}

View File

@ -34,7 +34,7 @@ class CheckboxComponent extends React.PureComponent {
}
this.setState({
checked: !this.state.checked,
isAnimating: true,
isAnimating: true
}, () => {
this.props.changeHandler ? this.props.changeHandler(this.props.name, this.state.checked) : null
});

View File

@ -1,7 +1,7 @@
import FileSaver from "file-saver";
import FileSaver from 'file-saver';
export default function saveJsonToFile(dataToSave, filename) {
const content = JSON.stringify(dataToSave, null, 2);
const blob = new Blob([content], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, filename + ".json");
const blob = new Blob([content], {type: 'text/plain;charset=utf-8'});
FileSaver.saveAs(blob, filename + '.json');
}

View File

@ -1,6 +1,6 @@
import StandardConfig from './StandardConfig';
import AwsConfig from './AwsConfig';
import PasswordConfig from "./PasswordConfig";
import PasswordConfig from './PasswordConfig';
const SERVER_CONFIG_JSON = require('../../../server_config.json');

View File

@ -4,8 +4,8 @@ import decode from 'jwt-decode';
export default class AuthService {
// SHA3-512 of '1234567890!@#$%^&*()_nothing_up_my_sleeve_1234567890!@#$%^&*()'
NO_AUTH_CREDS =
"55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d2062" +
"8d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557";
'55e97c9dcfd22b8079189ddaeea9bce8125887e3237b800c6176c9afa80d2062' +
'8d2c8d0b1538d2208c1444ac66535b764a3d902b35e751df3faec1e477ed3557';
SECONDS_BEFORE_JWT_EXPIRES = 20;