Copyright {rainge(2015)} Guardicore Ltd.
- Licensed under GPLv3.
+ Licensed under GPLv3.
- The source code is available on GitHub
+ The source code is available on GitHub
diff --git a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js
index 3839e55fd..997a2ae4c 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js
@@ -2,7 +2,8 @@ import React from 'react';
import {Col, Modal} from 'react-bootstrap';
import {Link} from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-import { faStopCircle, faMinus } from '@fortawesome/free-solid-svg-icons'
+import { faStopCircle } from '@fortawesome/free-solid-svg-icons/faStopCircle'
+import { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus'
import PreviewPaneComponent from 'components/map/preview-pane/PreviewPane';
import {ReactiveGraph} from 'components/reactive-graph/ReactiveGraph';
import {getOptions, edgeGroupToColor} from 'components/map/MapOptions';
diff --git a/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js b/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js
index e46970ac4..9696fa521 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/NotFoundPage.js
@@ -2,7 +2,7 @@ import React from 'react';
import '../../styles/NotFoundPage.scss';
-let monkeyDetective = require('../../images/detective-monkey.svg');
+import monkeyDetective from '../../images/detective-monkey.svg';
class ConfigurePageComponent extends React.Component{
constructor(props) {
@@ -12,7 +12,7 @@ class ConfigurePageComponent extends React.Component{
render(){
return(
-
+
404
Page not found
diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
index 17dcc9be7..a741148fb 100644
--- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
+++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js
@@ -5,12 +5,16 @@ import CopyToClipboard from 'react-copy-to-clipboard';
import GridLoader from 'react-spinners/GridLoader';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faClipboard, faCheck, faSync } from '@fortawesome/free-solid-svg-icons';
+import { faClipboard } from '@fortawesome/free-solid-svg-icons/faClipboard';
+import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
+import { faSync } from '@fortawesome/free-solid-svg-icons/faSync';
import {Link} from 'react-router-dom';
import AuthComponent from '../AuthComponent';
import AwsRunTable from '../run-monkey/AwsRunTable';
+import '../../styles/MonkeyRunPage.scss';
+
const loading_css_override = css`
display: block;
margin-right: auto;
@@ -252,7 +256,7 @@ class RunMonkeyPageComponent extends AuthComponent {
Not sure what this is? Not seeing your AWS EC2 instances? Read the documentation!
+ rel="noopener noreferrer" target="_blank">Read the documentation!
{
@@ -325,7 +329,8 @@ class RunMonkeyPageComponent extends AuthComponent {
Choose the operating system where you want to run the monkey
{this.state.ips.length > 1 ? ', and the interface to communicate with.' : '.'}
-
-
Newer version available!
- Download here
+ Download here
:
undefined
diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js b/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js
index 6d2d0c035..54aaa46ec 100644
--- a/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js
+++ b/monkey/monkey_island/cc/ui/src/components/ui-components/Checkbox.js
@@ -83,7 +83,7 @@ class CheckboxComponent extends React.PureComponent {
type='checkbox' value={this.state.checked}
name={this.props.name}/>
-
+
)
}
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_linux.png
deleted file mode 100644
index 5c00186c5..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_unknown.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_unknown.png
deleted file mode 100644
index 3b1e9b638..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_unknown.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_windows.png
deleted file mode 100644
index 08f8f37f1..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/clean_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_linux.png
deleted file mode 100644
index e95dfdd71..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_windows.png
deleted file mode 100644
index 75350fb73..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/exploited_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island.png
deleted file mode 100644
index 68d627b32..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux.png
deleted file mode 100644
index f98b5ebbd..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_running.png
deleted file mode 100644
index 62fabc360..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_starting.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_starting.png
deleted file mode 100644
index cd53d7cb7..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_linux_starting.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows.png
deleted file mode 100644
index 79cb177e1..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_running.png
deleted file mode 100644
index 525f671a1..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_starting.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_starting.png
deleted file mode 100644
index 67129b5cc..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/island_monkey_windows_starting.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux.png
deleted file mode 100644
index fedb1e426..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux_running.png
deleted file mode 100644
index d57728276..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_linux_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows.png
deleted file mode 100644
index 950c10fb6..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows_running.png
deleted file mode 100644
index 8eef19528..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/manual_windows_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux.png
deleted file mode 100644
index dad9c2b01..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_old.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_old.png
deleted file mode 100644
index d582c8ecf..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_old.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_running.png
deleted file mode 100644
index 21cded913..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_starting.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_starting.png
deleted file mode 100644
index a7aa12793..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_linux_starting.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows.png
deleted file mode 100644
index 669630d21..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_old.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_old.png
deleted file mode 100644
index 58de7ff52..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_old.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_running.png
deleted file mode 100644
index 6c6daf672..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_starting.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_starting.png
deleted file mode 100644
index 1545280b4..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/monkey_windows_starting.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_linux.png
deleted file mode 100644
index 5c00186c5..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_unknown.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_unknown.png
deleted file mode 100644
index 3b1e9b638..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_clean_unknown.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_exploited_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_exploited_linux.png
deleted file mode 100644
index e95dfdd71..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_exploited_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island.png
deleted file mode 100644
index 68d627b32..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows.png
deleted file mode 100644
index 79cb177e1..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows_running.png
deleted file mode 100644
index 525f671a1..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_island_monkey_windows_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux.png
deleted file mode 100644
index dad9c2b01..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_running.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_running.png
deleted file mode 100644
index 21cded913..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_running.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_starting.png b/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_starting.png
deleted file mode 100644
index a7aa12793..000000000
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/Old_icons/old_monkey_linux_starting.png and /dev/null differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/pth/critical.png b/monkey/monkey_island/cc/ui/src/images/nodes/pth/critical.png
index 0348a7f5d..d508d262d 100644
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/pth/critical.png and b/monkey/monkey_island/cc/ui/src/images/nodes/pth/critical.png differ
diff --git a/monkey/monkey_island/cc/ui/src/images/nodes/pth/normal.png b/monkey/monkey_island/cc/ui/src/images/nodes/pth/normal.png
index 3b1e9b638..0b5093c3b 100644
Binary files a/monkey/monkey_island/cc/ui/src/images/nodes/pth/normal.png and b/monkey/monkey_island/cc/ui/src/images/nodes/pth/normal.png differ
diff --git a/monkey/monkey_island/cc/ui/src/index.html b/monkey/monkey_island/cc/ui/src/index.html
index 38b0c114d..73df26ad1 100644
--- a/monkey/monkey_island/cc/ui/src/index.html
+++ b/monkey/monkey_island/cc/ui/src/index.html
@@ -1,11 +1,14 @@
-
+
Infection Monkey Island Server
+
+
+
diff --git a/monkey/monkey_island/cc/ui/src/index.js b/monkey/monkey_island/cc/ui/src/index.js
index b2c79eaf9..546edb0cc 100644
--- a/monkey/monkey_island/cc/ui/src/index.js
+++ b/monkey/monkey_island/cc/ui/src/index.js
@@ -1,7 +1,7 @@
+import '@babel/polyfill';
import 'core-js/fn/object/assign';
import React from 'react';
import ReactDOM from 'react-dom';
-import 'babel-polyfill';
import App from './components/Main';
import Bootstrap from 'bootstrap/dist/css/bootstrap.css'; // eslint-disable-line no-unused-vars
diff --git a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js
index bd71817e1..14bd5c3ba 100644
--- a/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js
+++ b/monkey/monkey_island/cc/ui/src/server_config/ServerConfig.js
@@ -2,7 +2,7 @@ import StandardConfig from './StandardConfig';
import AwsConfig from './AwsConfig';
import PasswordConfig from './PasswordConfig';
-const SERVER_CONFIG_JSON = require('../../../server_config.json');
+import SERVER_CONFIG_JSON from '../../../server_config.json';
const CONFIG_DICT =
{
diff --git a/monkey/monkey_island/cc/ui/src/styles/App.css b/monkey/monkey_island/cc/ui/src/styles/App.css
index 3a6cf25d0..c7c9bc564 100644
--- a/monkey/monkey_island/cc/ui/src/styles/App.css
+++ b/monkey/monkey_island/cc/ui/src/styles/App.css
@@ -1,5 +1,4 @@
-@import url('https://fonts.googleapis.com/css?family=Open+Sans');
-@import url('https://fonts.googleapis.com/css?family=Alegreya');
+@import url('https://fonts.googleapis.com/css?family=Open+Sans|Alegreya&display=swap');
/* Base Application Styles */
diff --git a/monkey/monkey_island/cc/ui/src/styles/MonkeyRunPage.scss b/monkey/monkey_island/cc/ui/src/styles/MonkeyRunPage.scss
new file mode 100644
index 000000000..82d306fd8
--- /dev/null
+++ b/monkey/monkey_island/cc/ui/src/styles/MonkeyRunPage.scss
@@ -0,0 +1,5 @@
+$blue: #337ab7;
+
+#bootstrap-override.runOnOsButtons > li.active > a{
+ background-color: $blue !important;
+}
diff --git a/monkey/monkey_island/cc/ui/webpack.config.js b/monkey/monkey_island/cc/ui/webpack.config.js
index 7c56ccff2..08c2a77f3 100644
--- a/monkey/monkey_island/cc/ui/webpack.config.js
+++ b/monkey/monkey_island/cc/ui/webpack.config.js
@@ -8,7 +8,7 @@ module.exports = {
test: /\.js$/,
exclude: /node_modules/,
use: {
- loader: "babel-loader"
+ loader: "babel-loader",
}
},
{
diff --git a/monkey/monkey_island/cc/utils.py b/monkey/monkey_island/cc/utils.py
index 5504c34b6..37af43745 100644
--- a/monkey/monkey_island/cc/utils.py
+++ b/monkey/monkey_island/cc/utils.py
@@ -20,7 +20,6 @@ if sys.platform == "win32":
else:
import fcntl
-
def local_ips():
result = []
try:
diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control
index a47371005..a7bc2373e 100644
--- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/control
+++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/control
@@ -5,4 +5,4 @@ Homepage: https://www.infectionmonkey.com
Priority: optional
Version: 1.0
Description: Guardicore Infection Monkey Island installation package
-Depends: openssl, python3-pip, python3-dev
+Depends: openssl, python3.7-dev, python3.7-venv, python3-venv, build-essential
diff --git a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst
index f79a71913..f12b31b73 100644
--- a/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst
+++ b/monkey/monkey_island/deb-package/DEBIAN_MONGO/postinst
@@ -1,20 +1,42 @@
#!/bin/bash
+# See the "Depends" field of the control file for what packages this scripts depends on.
+# Here are the explanations for the current deps:
+# Dependency - Why is it required
+## openssl - Server certificate generation
+## python3.7-dev - Server runtime
+## python3.7-venv - For creating virtual env to install all the server pip deps (don't want to pollute system python)
+## python3-venv - python3.7-venv doesn't work without it since you need ensure-pip
+## build-essential - for compiling python dependencies that don't come in a pre-compiled wheel, like `netifaces`
+
+echo "Installing Monkey Island (Infection Monkey server)..."
+
MONKEY_FOLDER=/var/monkey
INSTALLATION_FOLDER=/var/monkey/monkey_island/installation
PYTHON_FOLDER=/var/monkey/monkey_island/bin/python
+PYTHON_VERSION=python3.7
# Prepare python virtualenv
-pip3 install virtualenv --no-index --find-links file://$INSTALLATION_FOLDER
-python3 -m virtualenv -p python3 ${PYTHON_FOLDER}
+# This is using the apt package `python3.7-venv` which is listed in the `control` file as a dependency.
+# See https://packages.debian.org/stable/python/python3.7-venv
+echo "Using $(command -v $PYTHON_VERSION) as the base for virtualenv creation"
+$PYTHON_VERSION -m venv ${PYTHON_FOLDER}
+# shellcheck disable=SC1090
+source ${PYTHON_FOLDER}/bin/activate
-# install pip requirements
-${PYTHON_FOLDER}/bin/python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
+echo "Installing Python dependencies using $(command -v python) and $(command -v pip)..."
+# First, make sure that pip is updated
+python -m pip install --upgrade pip
+# Then install the dependecies from the pre-downloaded whl and tar.gz file
+python -m pip install -r $MONKEY_FOLDER/monkey_island/requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER
+
+deactivate
# remove installation folder and unnecessary files
rm -rf ${INSTALLATION_FOLDER}
rm -f ${MONKEY_FOLDER}/monkey_island/requirements.txt
+echo "Installing mongodb..."
${MONKEY_FOLDER}/monkey_island/install_mongo.sh ${MONKEY_FOLDER}/monkey_island/bin/mongodb
if [ -d "/etc/systemd/network" ]; then
@@ -25,11 +47,17 @@ if [ -d "/etc/systemd/network" ]; then
systemctl enable monkey-island
fi
-${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/
+echo "Creating server certificate..."
+${MONKEY_FOLDER}/monkey_island/create_certificate.sh ${MONKEY_FOLDER}/monkey_island/cc
+echo "Starting services..."
service monkey-island start
service monkey-mongo start
-echo Monkey Island installation ended
+echo ""
+echo "Monkey Island installation ended."
+echo "The server should be accessible soon via https://:5000/"
+echo "To check the Island's status, run 'sudo service monkey-island status'"
+echo ""
-exit 0
\ No newline at end of file
+exit 0
diff --git a/monkey/monkey_island/linux/create_certificate.sh b/monkey/monkey_island/linux/create_certificate.sh
index 7e306a822..985f607bc 100644
--- a/monkey/monkey_island/linux/create_certificate.sh
+++ b/monkey/monkey_island/linux/create_certificate.sh
@@ -2,8 +2,29 @@
server_root=${1:-"./cc"}
+echo "Creating server cetificate. Server root: $server_root"
+# We override the RANDFILE determined by default openssl.cnf, if it doesn't exist.
+# This is a known issue with the current version of openssl on Ubuntu 18.04 - once they release
+# a new version, we can delete this command. See
+# https://github.com/openssl/openssl/commit/0f58220973a02248ca5c69db59e615378467b9c8#diff-8ce6aaad88b10ed2b3b4592fd5c8e03a
+# for more details.
+DEFAULT_RND_FILE_PATH=~/.rnd
+CREATED_RND_FILE=false
+if [ ! -f /tmp/foo.txt ]; then # If the file already exists, assume that the contents are fine, and don't change them.
+ echo "Creating rand seed file in $DEFAULT_RND_FILE_PATH"
+ dd bs=1024 count=2 "$DEFAULT_RND_FILE_PATH"
+ chmod 666 "$DEFAULT_RND_FILE_PATH"
+ CREATED_RND_FILE=true
+fi
+echo "Generating key in $server_root/server.key..."
openssl genrsa -out "$server_root"/server.key 2048
+echo "Generating csr in $server_root/server.csr..."
openssl req -new -key "$server_root"/server.key -out "$server_root"/server.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=Monkey Department/CN=monkey.com"
-openssl x509 -req -days 366 -in "$server_root"/server.csr -signkey "$server_root"/server.key -out $server_root/server.crt
+echo "Generating certificate in $server_root/server.crt..."
+openssl x509 -req -days 366 -in "$server_root"/server.csr -signkey "$server_root"/server.key -out "$server_root"/server.crt
+# Shove some new random data into the file to override the original seed we put in.
+if [ "$CREATED_RND_FILE" = true ] ; then
+ dd bs=1024 count=2 "$DEFAULT_RND_FILE_PATH"
+fi
diff --git a/monkey/monkey_island/monkey_island.spec b/monkey/monkey_island/monkey_island.spec
index ef6d9c2d3..59f95e34f 100644
--- a/monkey/monkey_island/monkey_island.spec
+++ b/monkey/monkey_island/monkey_island.spec
@@ -1,7 +1,7 @@
# -*- mode: python -*-
import os
import platform
-
+import sys
__author__ = 'itay.mizeretz'
@@ -9,15 +9,20 @@ block_cipher = None
def main():
+ # These data files and folders will be included in the bundle.
+ # The format of the tuples is (src, dest_dir). See https://pythonhosted.org/PyInstaller/spec-files.html#adding-data-files
+ added_datas = [
+ ("../common/BUILD", "/common"),
+ ("../monkey_island/cc/services/attack/attack_data", "/monkey_island/cc/services/attack/attack_data")
+ ]
+
a = Analysis(['cc/main.py'],
pathex=['..'],
hiddenimports=get_hidden_imports(),
- hookspath=None,
+ hookspath=[os.path.join(".", "pyinstaller_hooks")],
runtime_hooks=None,
binaries=None,
- datas=[
- ("../common/BUILD", "/common")
- ],
+ datas=added_datas,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
@@ -36,8 +41,7 @@ def main():
name=get_monkey_filename(),
debug=False,
strip=get_exe_strip(),
- upx=True,
- upx_exclude=['vcruntime140.dll'],
+ upx=False,
console=True,
icon=get_exe_icon())
@@ -74,7 +78,7 @@ def get_linux_only_binaries():
def get_hidden_imports():
- return ['_cffi_backend', 'queue'] if is_windows() else ['_cffi_backend']
+ return ['_cffi_backend', 'queue', 'pkg_resources.py2_warn'] if is_windows() else ['_cffi_backend']
def get_msvcr():
diff --git a/monkey/monkey_island/pyinstaller_hooks/__init__.py b/monkey/monkey_island/pyinstaller_hooks/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/monkey/monkey_island/pyinstaller_hooks/hook-stix2.py b/monkey/monkey_island/pyinstaller_hooks/hook-stix2.py
new file mode 100644
index 000000000..22a9c9774
--- /dev/null
+++ b/monkey/monkey_island/pyinstaller_hooks/hook-stix2.py
@@ -0,0 +1,7 @@
+# Workaround for packaging Monkey Island using PyInstaller. See https://github.com/oasis-open/cti-python-stix2/issues/218
+
+import os
+from PyInstaller.utils.hooks import get_module_file_attribute
+
+stix2_dir = os.path.dirname(get_module_file_attribute('stix2'))
+datas = [(stix2_dir, 'stix2')]
diff --git a/monkey/monkey_island/requirements.txt b/monkey/monkey_island/requirements.txt
index 39364cbb5..aa90c1916 100644
--- a/monkey/monkey_island/requirements.txt
+++ b/monkey/monkey_island/requirements.txt
@@ -1,5 +1,4 @@
pytest
-bson
python-dateutil
tornado
werkzeug
@@ -24,4 +23,4 @@ requests
dpath
ring
stix2
-tcdm
+tqdm