forked from p15670423/monkey
This commit is contained in:
parent
9d26b5698c
commit
accd6bd0fa
|
@ -89,7 +89,7 @@ script:
|
||||||
- cd monkey_island/cc/ui
|
- cd monkey_island/cc/ui
|
||||||
- npm ci # See https://docs.npmjs.com/cli/ci.html
|
- npm ci # See https://docs.npmjs.com/cli/ci.html
|
||||||
- eslint ./src --quiet # Test for errors
|
- eslint ./src --quiet # Test for errors
|
||||||
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=28
|
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=4
|
||||||
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings
|
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings
|
||||||
|
|
||||||
# Build documentation
|
# Build documentation
|
||||||
|
|
|
@ -274,9 +274,9 @@ class PreviewPaneComponent extends AuthComponent {
|
||||||
let label = '';
|
let label = '';
|
||||||
if (!this.props.item) {
|
if (!this.props.item) {
|
||||||
label = '';
|
label = '';
|
||||||
} else if (this.props.item.hasOwnProperty('label')) {
|
} else if (Object.prototype.hasOwnProperty.call(this.props.item, 'label')) {
|
||||||
label = this.props.item['label'];
|
label = this.props.item['label'];
|
||||||
} else if (this.props.item.hasOwnProperty('_label')) {
|
} else if (Object.prototype.hasOwnProperty.call(this.props.item, '_label')) {
|
||||||
label = this.props.item['_label'];
|
label = this.props.item['_label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
// Change value in attack configuration
|
// Change value in attack configuration
|
||||||
// Go trough each column in matrix, searching for technique
|
// Go trough each column in matrix, searching for technique
|
||||||
Object.entries(this.state.attackConfig).forEach(techType => {
|
Object.entries(this.state.attackConfig).forEach(techType => {
|
||||||
if (techType[1].properties.hasOwnProperty(technique)) {
|
if (Object.prototype.hasOwnProperty.call(techType[1].properties, technique)) {
|
||||||
let tempMatrix = this.state.attackConfig;
|
let tempMatrix = this.state.attackConfig;
|
||||||
tempMatrix[techType[0]].properties[technique].value = value;
|
tempMatrix[techType[0]].properties[technique].value = value;
|
||||||
this.setState({attackConfig: tempMatrix});
|
this.setState({attackConfig: tempMatrix});
|
||||||
|
@ -151,7 +151,8 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
Object.entries(this.state.attackConfig).forEach(otherType => {
|
Object.entries(this.state.attackConfig).forEach(otherType => {
|
||||||
Object.entries(otherType[1].properties).forEach(otherTech => {
|
Object.entries(otherType[1].properties).forEach(otherTech => {
|
||||||
// If this technique depends on a technique that was changed
|
// If this technique depends on a technique that was changed
|
||||||
if (otherTech[1].hasOwnProperty('depends_on') && otherTech[1]['depends_on'].includes(technique)) {
|
if (Object.prototype.hasOwnProperty.call(otherTech[1], 'depends_on') &&
|
||||||
|
otherTech[1]['depends_on'].includes(technique)) {
|
||||||
this.attackTechniqueChange(otherTech[0], value, true)
|
this.attackTechniqueChange(otherTech[0], value, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -393,7 +394,7 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let displayedSchema = {};
|
let displayedSchema = {};
|
||||||
if (this.state.schema.hasOwnProperty('properties') && this.state.selectedSection !== 'attack') {
|
if (Object.prototype.hasOwnProperty.call(this.state.schema, 'properties') && this.state.selectedSection !== 'attack') {
|
||||||
displayedSchema = this.state.schema['properties'][this.state.selectedSection];
|
displayedSchema = this.state.schema['properties'][this.state.selectedSection];
|
||||||
displayedSchema['definitions'] = this.state.schema['definitions'];
|
displayedSchema['definitions'] = this.state.schema['definitions'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class MapPageComponent extends AuthComponent {
|
||||||
this.authFetch('/api/netmap')
|
this.authFetch('/api/netmap')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.hasOwnProperty('edges')) {
|
if (Object.prototype.hasOwnProperty.call(res, 'edges')) {
|
||||||
res.edges.forEach(edge => {
|
res.edges.forEach(edge => {
|
||||||
edge.color = {'color': edgeGroupToColor(edge.group)};
|
edge.color = {'color': edgeGroupToColor(edge.group)};
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {Row, Col, Container, Form, Button} from 'react-bootstrap';
|
||||||
|
|
||||||
import AuthService from '../../services/AuthService';
|
import AuthService from '../../services/AuthService';
|
||||||
import monkeyDetective from '../../images/detective-monkey.svg';
|
import monkeyDetective from '../../images/detective-monkey.svg';
|
||||||
import ParticleBackground from "../ui-components/ParticleBackground";
|
import ParticleBackground from '../ui-components/ParticleBackground';
|
||||||
|
|
||||||
class RegisterPageComponent extends React.Component {
|
class RegisterPageComponent extends React.Component {
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
static selectReport(reports) {
|
static selectReport(reports) {
|
||||||
let url = window.location.href;
|
let url = window.location.href;
|
||||||
for (let report_name in reports) {
|
for (let report_name in reports) {
|
||||||
if (reports.hasOwnProperty(report_name) && url.endsWith(reports[report_name])) {
|
if (Object.prototype.hasOwnProperty.call(reports, report_name) && url.endsWith(reports[report_name])) {
|
||||||
return reports[report_name];
|
return reports[report_name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ class RunMonkeyPageComponent extends AuthComponent {
|
||||||
// update existing state, not run-over
|
// update existing state, not run-over
|
||||||
let prevRes = this.awsTable.state.result;
|
let prevRes = this.awsTable.state.result;
|
||||||
for (let key in result) {
|
for (let key in result) {
|
||||||
if (result.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
||||||
prevRes[key] = result[key];
|
prevRes[key] = result[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ class AttackReport extends React.Component {
|
||||||
|
|
||||||
getTechniqueByTitle(title){
|
getTechniqueByTitle(title){
|
||||||
for (const tech_id in this.state.techniques){
|
for (const tech_id in this.state.techniques){
|
||||||
if (! this.state.techniques.hasOwnProperty(tech_id)) {return false;}
|
if (! Object.prototype.hasOwnProperty.call(this.state.techniques, tech_id)) {return false;}
|
||||||
let technique = this.state.techniques[tech_id];
|
let technique = this.state.techniques[tech_id];
|
||||||
if (technique.title === title){
|
if (technique.title === title){
|
||||||
technique['tech_id'] = tech_id;
|
technique['tech_id'] = tech_id;
|
||||||
|
@ -148,10 +148,10 @@ class AttackReport extends React.Component {
|
||||||
// add links to techniques
|
// add links to techniques
|
||||||
schema = schema.properties;
|
schema = schema.properties;
|
||||||
for(const type in schema){
|
for(const type in schema){
|
||||||
if (! schema.hasOwnProperty(type)) {return false;}
|
if (! Object.prototype.hasOwnProperty.call(schema, type)) {return false;}
|
||||||
let typeTechniques = schema[type].properties;
|
let typeTechniques = schema[type].properties;
|
||||||
for(const tech_id in typeTechniques){
|
for(const tech_id in typeTechniques){
|
||||||
if (! typeTechniques.hasOwnProperty(tech_id)) {return false;}
|
if (! Object.prototype.hasOwnProperty.call(typeTechniques, tech_id)) {return false;}
|
||||||
if (typeTechniques[tech_id] !== undefined){
|
if (typeTechniques[tech_id] !== undefined){
|
||||||
techniques[tech_id]['link'] = typeTechniques[tech_id].link
|
techniques[tech_id]['link'] = typeTechniques[tech_id].link
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ReportMatrixComponent extends React.Component {
|
||||||
getColumns() {
|
getColumns() {
|
||||||
let columns = [];
|
let columns = [];
|
||||||
for(const type_key in this.state.schema.properties){
|
for(const type_key in this.state.schema.properties){
|
||||||
if (! this.state.schema.properties.hasOwnProperty(type_key)){
|
if (! Object.prototype.hasOwnProperty.call(this.state.schema.properties, type_key)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let tech_type = this.state.schema.properties[type_key];
|
let tech_type = this.state.schema.properties[type_key];
|
||||||
|
@ -32,11 +32,11 @@ class ReportMatrixComponent extends React.Component {
|
||||||
getTableRows() {
|
getTableRows() {
|
||||||
let rows = [];
|
let rows = [];
|
||||||
for (const tech_id in this.state.techniques) {
|
for (const tech_id in this.state.techniques) {
|
||||||
if (this.state.techniques.hasOwnProperty(tech_id)){
|
if (Object.prototype.hasOwnProperty.call(this.state.techniques, tech_id)){
|
||||||
let technique_added = false;
|
let technique_added = false;
|
||||||
let technique = this.state.techniques[tech_id];
|
let technique = this.state.techniques[tech_id];
|
||||||
for(const row of rows){
|
for(const row of rows){
|
||||||
if (! row.hasOwnProperty(technique.type)){
|
if (! Object.prototype.hasOwnProperty.call(row, technique.type)){
|
||||||
row[technique.type] = technique;
|
row[technique.type] = technique;
|
||||||
technique_added = true;
|
technique_added = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -79,13 +79,13 @@ class TechniqueDropdowns extends React.Component{
|
||||||
getOrderedTechniqueList(){
|
getOrderedTechniqueList(){
|
||||||
let content = [];
|
let content = [];
|
||||||
for(const type_key in this.state.schema.properties){
|
for(const type_key in this.state.schema.properties){
|
||||||
if (! this.state.schema.properties.hasOwnProperty(type_key)){
|
if (! Object.prototype.hasOwnProperty.call(this.state.schema.properties, type_key)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let tech_type = this.state.schema.properties[type_key];
|
let tech_type = this.state.schema.properties[type_key];
|
||||||
content.push(<h3>{tech_type.title}</h3>);
|
content.push(<h3>{tech_type.title}</h3>);
|
||||||
for(const tech_id in this.state.techniques){
|
for(const tech_id in this.state.techniques){
|
||||||
if (! this.state.techniques.hasOwnProperty(tech_id)){
|
if (! Object.prototype.hasOwnProperty.call(this.state.techniques, tech_id)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let technique = this.state.techniques[tech_id];
|
let technique = this.state.techniques[tech_id];
|
||||||
|
|
|
@ -209,7 +209,7 @@ class VennDiagram extends React.Component {
|
||||||
|
|
||||||
if (key_ === 'Data') {
|
if (key_ === 'Data') {
|
||||||
this.layout[key_].fontStyle = this.fontStyles[0];
|
this.layout[key_].fontStyle = this.fontStyles[0];
|
||||||
} else if (this.layout[key_].hasOwnProperty('cx')) {
|
} else if (Object.prototype.hasOwnProperty.call(this.layout[key_], 'cx')) {
|
||||||
this.layout[key_].fontStyle = this.fontStyles[1];
|
this.layout[key_].fontStyle = this.fontStyles[1];
|
||||||
} else {
|
} else {
|
||||||
this.layout[key_].fontStyle = this.fontStyles[2];
|
this.layout[key_].fontStyle = this.fontStyles[2];
|
||||||
|
@ -229,7 +229,7 @@ class VennDiagram extends React.Component {
|
||||||
// equivalent to center translate (width/2, height/2)
|
// equivalent to center translate (width/2, height/2)
|
||||||
let viewPortParameters = (-this.width / 2) + ' ' + (-this.height / 2) + ' ' + this.width + ' ' + this.height;
|
let viewPortParameters = (-this.width / 2) + ' ' + (-this.height / 2) + ' ' + this.width + ' ' + this.height;
|
||||||
let nodes = Object.values(this.layout).map((d_, i_) => {
|
let nodes = Object.values(this.layout).map((d_, i_) => {
|
||||||
if (d_.hasOwnProperty('cx')) {
|
if (Object.prototype.hasOwnProperty.call(d_, 'cx')) {
|
||||||
return (
|
return (
|
||||||
<CircularNode
|
<CircularNode
|
||||||
prefix={this.prefix}
|
prefix={this.prefix}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class AwsRunTableComponent extends React.Component {
|
||||||
let instId = r.original.instance_id;
|
let instId = r.original.instance_id;
|
||||||
if (this.isSelected(instId)) {
|
if (this.isSelected(instId)) {
|
||||||
color = '#ffed9f';
|
color = '#ffed9f';
|
||||||
} else if (this.state.result.hasOwnProperty(instId)) {
|
} else if (Object.prototype.hasOwnProperty.call(this.state.result, instId)) {
|
||||||
color = this.state.result[instId] ? '#00f01b' : '#f00000'
|
color = this.state.result[instId] ? '#00f01b' : '#f00000'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class CheckboxComponent extends React.PureComponent {
|
||||||
*/
|
*/
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
if (this.props.hasOwnProperty('status')){
|
if (Object.prototype.hasOwnProperty.call(this.props, 'status')){
|
||||||
this.status = this.props.status;
|
this.status = this.props.status;
|
||||||
} else {
|
} else {
|
||||||
this.status = false
|
this.status = false
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default class AuthService {
|
||||||
})
|
})
|
||||||
}).then(response => response.json())
|
}).then(response => response.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.hasOwnProperty('access_token')) {
|
if (Object.prototype.hasOwnProperty.call(res, 'access_token')) {
|
||||||
this._setToken(res['access_token']);
|
this._setToken(res['access_token']);
|
||||||
return {result: true};
|
return {result: true};
|
||||||
} else {
|
} else {
|
||||||
|
@ -86,7 +86,7 @@ export default class AuthService {
|
||||||
headers['Authorization'] = 'Bearer ' + this._getToken();
|
headers['Authorization'] = 'Bearer ' + this._getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.hasOwnProperty('headers')) {
|
if (Object.prototype.hasOwnProperty.call(options, 'headers')) {
|
||||||
for (let header in headers) {
|
for (let header in headers) {
|
||||||
options['headers'][header] = headers[header];
|
options['headers'][header] = headers[header];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue