Merge remote-tracking branch 'upstream/develop' into zt_performance_fixes

This commit is contained in:
VakarisZ 2020-05-13 11:21:37 +03:00
commit cff92303e5
9 changed files with 2444 additions and 13088 deletions

View File

@ -1,10 +1,15 @@
# Infection Monkey travis.yml. See Travis documentation for information about this file structure.
# If you change this file, you can validate using Travis CI's Build Config Explorer https://config.travis-ci.com/explore
group: travis_latest
language: python
cache: pip
cache:
- pip
- directories:
- "$HOME/.npm"
python:
- 3.7
@ -18,6 +23,19 @@ install:
- pip install coverage # for code coverage
- pip install -r monkey/infection_monkey/requirements.txt # for unit tests
# node + npm + eslint
- node --version
- npm --version
# Install NVM, see https://github.com/nvm-sh/nvm#installing-and-updating
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
- export NVM_DIR="$HOME/.nvm"
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- nvm install node
- nvm use node
- npm i -g eslint
- node --version
- npm --version
before_script:
# Set the server config to `testing`. This is required for for the UTs to pass.
- python monkey/monkey_island/cc/set_server_config.py testing
@ -48,13 +66,10 @@ script:
# Check JS code. The npm install must happen AFTER the flake8 because the node_modules folder will cause a lot of errors.
- cd monkey_island/cc/ui
- npm i
- npm i -g eslint
- cd -
- cd monkey_island/cc/ui
- eslint ./src --quiet
- npm ci # See https://docs.npmjs.com/cli/ci.html
- eslint ./src --quiet # Test for errors
- JS_WARNINGS_AMOUNT_UPPER_LIMIT=490
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT
- eslint ./src --max-warnings $JS_WARNINGS_AMOUNT_UPPER_LIMIT # Test for max warnings
after_success:
# Upload code coverage results to codecov.io, see https://github.com/codecov/codecov-bash for more information

View File

@ -1,5 +1,7 @@
import wmi
import win32com
import sys
if sys.platform == 'win32':
import win32com
import wmi
__author__ = 'maor.rayzin'

View File

@ -1,25 +0,0 @@
import winreg
from common.utils.mongo_utils import MongoUtils
__author__ = 'maor.rayzin'
class RegUtils:
def __init__(self):
# Static class
pass
@staticmethod
def get_reg_key(subkey_path, store=winreg.HKEY_LOCAL_MACHINE):
key = winreg.ConnectRegistry(None, store)
subkey = winreg.OpenKey(key, subkey_path)
d = dict([winreg.EnumValue(subkey, i)[:2] for i in range(winreg.QueryInfoKey(subkey)[0])])
d = MongoUtils.fix_obj_for_mongo(d)
subkey.Close()
key.Close()
return d

View File

@ -80,8 +80,12 @@ class InfectionMonkey(object):
self._default_tunnel = self._opts.tunnel
self._default_server = self._opts.server
if self._opts.depth:
if self._opts.depth is not None:
WormConfiguration._depth_from_commandline = True
WormConfiguration.depth = self._opts.depth
LOG.debug(f"Setting propagation depth from command line")
LOG.debug(f"Set propagation depth to {WormConfiguration.depth}")
self._keep_running = True
self._network = NetworkScanner()
self._dropper_path = sys.argv[0]

View File

@ -13,8 +13,7 @@ ipaddress
# See breaking change here: https://github.com/tjguk/wmi/commit/dcf8e3eca79bb8c0101ffb83e25c066b0ba9e16d
# Causes pip to error with:
# Could not find a version that satisfies the requirement pywin32 (from wmi->-r /src/infection_monkey/requirements.txt (line 12)) (from versions: none)
wmi==1.4.9
pywin32 ; sys_platform == 'win32'
wmi==1.4.9 ; sys_platform == 'win32'
pymssql<3.0
pyftpdlib
WinSys-3.x

View File

@ -1,36 +0,0 @@
var webpackCfg = require('./webpack.config');
// Set node environment to testing
process.env.NODE_ENV = 'test';
module.exports = function (config) {
config.set({
basePath: '',
browsers: ['PhantomJS'],
files: [
'test/loadtests.js'
],
port: 8000,
captureTimeout: 60000,
frameworks: ['mocha', 'chai'],
client: {
mocha: {}
},
singleRun: true,
reporters: ['mocha', 'coverage'],
preprocessors: {
'test/loadtests.js': ['webpack', 'sourcemap']
},
webpack: webpackCfg,
webpackServer: {
noInfo: true
},
coverageReporter: {
dir: 'coverage/',
reporters: [
{type: 'html'},
{type: 'text'}
]
}
});
};

File diff suppressed because it is too large Load Diff

View File

@ -14,14 +14,15 @@
"release:patch": "npm version patch && npm publish && git push --follow-tags",
"serve": "node server.js --env=dev",
"serve:dist": "node server.js --env=dist",
"start": "webpack-dev-server --verbose --mode development --open --history-api-fallback --port 8000",
"test": "karma start",
"test:watch": "karma start --autoWatch=true --singleRun=false"
"start": "webpack-dev-server --verbose --mode development --open --history-api-fallback --port 8000"
},
"repository": "",
"keywords": [],
"author": "Guardicore",
"browserslist": "> 0.25%, not dead",
"browserslist": [
"> 0.25%",
"not dead"
],
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
@ -32,8 +33,6 @@
"@babel/runtime": "^7.9.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.0",
"chai": "^4.2.0",
"copyfiles": "^2.2.0",
"css-loader": "^3.5.0",
"eslint": "^6.8.0",
"eslint-loader": "^4.0.1",
@ -42,27 +41,19 @@
"glob": "^7.1.6",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"karma": "^3.1.4",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.1.2",
"karma-mocha": "^1.0.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^3.0.5",
"minimist": "^1.2.5",
"mocha": "^5.2.0",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.16",
"react-addons-test-utils": "^15.6.2",
"react-event-timeline": "^1.6.3",
"react-hot-loader": "^4.12.20",
"rimraf": "^2.7.1",
"style-loader": "^0.22.1",
"copyfiles": "^2.2.0",
"url-loader": "^1.1.2",
"sass-loader": "^7.3.1",
"node-sass": "^4.14.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
"stylelint": "^13.3.3",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@babel/polyfill": "^7.8.0",
@ -80,13 +71,10 @@
"fetch": "^1.1.0",
"file-saver": "^2.0.2",
"filepond": "^4.7.3",
"json-loader": "^0.5.7",
"jwt-decode": "^2.2.0",
"marked": "^0.8.2",
"moment": "^2.24.0",
"node-sass": "^4.13.0",
"normalize.css": "^8.0.0",
"npm": "^6.13.1",
"npm": "^6.14.5",
"pluralize": "^7.0.0",
"prop-types": "^15.7.2",
"rainge": "^1.0.1",
@ -97,6 +85,8 @@
"react-data-components": "^1.2.0",
"react-desktop-notification": "^1.0.9",
"react-dimensions": "^1.3.0",
"react-event-timeline": "^1.6.3",
"react-hot-loader": "^4.12.20",
"react-dom": "^16.12.0",
"react-fa": "^5.0.0",
"react-filepond": "^7.0.1",
@ -110,8 +100,6 @@
"react-toggle": "^4.1.1",
"react-tooltip-lite": "^1.10.0",
"redux": "^4.0.4",
"sass-loader": "^7.3.1",
"sha3": "^2.0.7",
"stylelint": "^13.3.3"
"sha3": "^2.0.7"
}
}

View File

@ -4,7 +4,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle'
import { faChevronUp } from '@fortawesome/free-solid-svg-icons/faChevronUp'
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown'
import { faToggleOn } from '@fortawesome/free-solid-svg-icons/faToggleON'
import { faToggleOn } from '@fortawesome/free-solid-svg-icons/faToggleOn'
import {Button} from 'react-bootstrap';
import AttackReport from '../AttackReport';