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