diff --git a/monkey_island/cc/app.py b/monkey_island/cc/app.py index a962bec49..6ca21cab8 100644 --- a/monkey_island/cc/app.py +++ b/monkey_island/cc/app.py @@ -71,7 +71,7 @@ def init_app(mongo_url): api.add_resource(Root, '/api') api.add_resource(Monkey, '/api/monkey', '/api/monkey/', '/api/monkey/') - api.add_resource(LocalRun, '/api/island', '/api/island/') + api.add_resource(LocalRun, '/api/local-monkey', '/api/local-monkey/') api.add_resource(Telemetry, '/api/telemetry', '/api/telemetry/', '/api/telemetry/') api.add_resource(MonkeyConfiguration, '/api/configuration', '/api/configuration/') api.add_resource(MonkeyDownload, '/api/monkey/download', '/api/monkey/download/', diff --git a/monkey_island/cc/resources/local_run.py b/monkey_island/cc/resources/local_run.py index c1d78267c..ef89d400e 100644 --- a/monkey_island/cc/resources/local_run.py +++ b/monkey_island/cc/resources/local_run.py @@ -3,7 +3,7 @@ import os from shutil import copyfile import sys -from flask import request +from flask import request, jsonify, make_response import flask_restful from cc.resources.monkey_download import get_monkey_executable @@ -47,16 +47,14 @@ def run_local_monkey(island_address): class LocalRun(flask_restful.Resource): def get(self): - req_type = request.args.get('type') - if req_type == "interfaces": - return {"interfaces": local_ips()} - else: - return {"message": "unknown action"} + # TODO implement is_running from db monkeys collection + return jsonify(is_running=False) def post(self): - action_json = json.loads(request.data) - if 'action' in action_json: - if action_json["action"] == "monkey" and action_json.get("island_address") is not None: - return {"res": run_local_monkey(action_json.get("island_address"))} + body = json.loads(request.data) + if body.get('action') == 'run' and body.get('ip') is not None: + local_run = run_local_monkey(island_address=body.get('ip')) + return jsonify(is_running=local_run[0]) - return {"res": (False, "Unknown action")} + # default action + return make_response({'error': 'Invalid action'}, 500) diff --git a/monkey_island/cc/resources/root.py b/monkey_island/cc/resources/root.py index fce718a19..f6ed8edf1 100644 --- a/monkey_island/cc/resources/root.py +++ b/monkey_island/cc/resources/root.py @@ -16,7 +16,7 @@ class Root(flask_restful.Resource): action = request.args.get('action') if not action: - return jsonify(ips=local_ip_addresses(), mongo=str(mongo.db)) + return jsonify(ip_addresses=local_ip_addresses(), mongo=str(mongo.db)) elif action == "reset": mongo.db.config.drop() diff --git a/monkey_island/cc/ui/package-lock.json b/monkey_island/cc/ui/package-lock.json index 847f6c2c3..f7caf5e1a 100644 --- a/monkey_island/cc/ui/package-lock.json +++ b/monkey_island/cc/ui/package-lock.json @@ -288,21 +288,21 @@ } }, "babel-core": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.25.0.tgz", - "integrity": "sha1-fdQrBGPHQunVKW3rPsZ6kyLa1yk=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", "dev": true, "requires": { - "babel-code-frame": "6.22.0", - "babel-generator": "6.25.0", + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.0", "babel-helpers": "6.24.1", "babel-messages": "6.23.0", - "babel-register": "6.24.1", - "babel-runtime": "6.25.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.4", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", "convert-source-map": "1.5.0", "debug": "2.6.8", "json5": "0.5.1", @@ -312,6 +312,83 @@ "private": "0.1.7", "slash": "1.0.0", "source-map": "0.5.6" + }, + "dependencies": { + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + } } }, "babel-eslint": { @@ -328,19 +405,49 @@ } }, "babel-generator": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", - "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true, "requires": { "babel-messages": "6.23.0", - "babel-runtime": "6.25.0", - "babel-types": "6.25.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", "detect-indent": "4.0.0", "jsesc": "1.3.0", "lodash": "4.17.4", "source-map": "0.5.6", "trim-right": "1.0.1" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + } } }, "babel-helper-bindify-decorators": { @@ -1041,14 +1148,34 @@ } }, "babel-polyfill": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz", - "integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "dev": true, "requires": { - "babel-runtime": "6.25.0", - "core-js": "2.5.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.1", "regenerator-runtime": "0.10.5" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + } + } + } } }, "babel-preset-es2015": { @@ -1154,18 +1281,36 @@ } }, "babel-register": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", - "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", "dev": true, "requires": { - "babel-core": "6.25.0", - "babel-runtime": "6.25.0", - "core-js": "2.5.0", + "babel-core": "6.26.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.1", "home-or-tmp": "2.0.0", "lodash": "4.17.4", "mkdirp": "0.5.1", - "source-map-support": "0.4.15" + "source-map-support": "0.4.17" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + } } }, "babel-runtime": { @@ -1173,7 +1318,7 @@ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", "requires": { - "core-js": "2.5.0", + "core-js": "2.5.1", "regenerator-runtime": "0.10.5" } }, @@ -1532,9 +1677,9 @@ "dev": true }, "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, "center-align": { @@ -1749,12 +1894,6 @@ "delayed-stream": "1.0.0" } }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -1946,9 +2085,9 @@ } }, "core-js": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", - "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" }, "core-util-is": { "version": "1.0.2", @@ -2940,40 +3079,26 @@ } }, "extract-zip": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.5.0.tgz", - "integrity": "sha1-ksz22B73Cp+kwXRxFMzvbYaIpsQ=", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz", + "integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=", "dev": true, "requires": { - "concat-stream": "1.5.0", - "debug": "0.7.4", + "concat-stream": "1.6.0", + "debug": "2.2.0", "mkdirp": "0.5.0", "yauzl": "2.4.1" }, "dependencies": { - "concat-stream": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.0.tgz", - "integrity": "sha1-U/fUPFHF5D+ByP3QMyHGMb5o1hE=", + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", "dev": true, "requires": { - "inherits": "2.0.3", - "readable-stream": "2.0.6", - "typedarray": "0.0.6" + "ms": "0.7.1" } }, - "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", @@ -2989,19 +3114,11 @@ "minimist": "0.0.8" } }, - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "0.10.31", - "util-deprecate": "1.0.2" - } + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "dev": true } } }, @@ -4330,16 +4447,20 @@ } } }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "dev": true + }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "dev": true, "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.16.0", - "pinkie-promise": "2.0.1" + "ajv": "4.11.8", + "har-schema": "1.0.5" } }, "has": { @@ -4410,14 +4531,14 @@ } }, "history": { - "version": "4.6.3", - "resolved": "https://registry.npmjs.org/history/-/history-4.6.3.tgz", - "integrity": "sha1-bXI6hxLFgda+836MJvSu3G64aWc=", + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz", + "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==", "requires": { "invariant": "2.2.2", "loose-envify": "1.3.1", - "resolve-pathname": "2.1.0", - "value-equal": "0.2.1", + "resolve-pathname": "2.2.0", + "value-equal": "0.4.0", "warning": "3.0.0" } }, @@ -4428,9 +4549,9 @@ "dev": true }, "hoist-non-react-statics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", - "integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz", + "integrity": "sha1-ND24TGAYxlB3iJgkATWhQg7iLOA=" }, "home-or-tmp": { "version": "2.0.0", @@ -4899,7 +5020,7 @@ "integrity": "sha1-HekZlvSAsi3LGsqFECVbrhV0RG4=", "dev": true, "requires": { - "babel-core": "6.25.0", + "babel-core": "6.26.0", "escodegen": "1.8.1", "esprima": "2.7.3", "istanbul": "0.4.5", @@ -5107,9 +5228,9 @@ "dev": true }, "karma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.0.tgz", - "integrity": "sha1-b3oaQGRG+i4YfslTmGmPTO5HYmk=", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", + "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==", "dev": true, "requires": { "bluebird": "3.5.0", @@ -5118,7 +5239,7 @@ "colors": "1.1.2", "combine-lists": "1.0.1", "connect": "3.6.3", - "core-js": "2.5.0", + "core-js": "2.5.1", "di": "0.0.1", "dom-serialize": "2.2.1", "expand-braces": "0.1.2", @@ -5186,12 +5307,66 @@ } }, "karma-mocha-reporter": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.3.tgz", - "integrity": "sha1-BP3aRaHZaXpzhxx0ciI8WBcBqyA=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.4.tgz", + "integrity": "sha1-DJyyLCfYZND2aU3wzwHKq86QZNQ=", "dev": true, "requires": { - "chalk": "1.1.3" + "chalk": "2.1.0", + "log-symbols": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "karma-phantomjs-launcher": { @@ -5201,7 +5376,7 @@ "dev": true, "requires": { "lodash": "4.17.4", - "phantomjs-prebuilt": "2.1.14" + "phantomjs-prebuilt": "2.1.15" } }, "karma-sourcemap-loader": { @@ -5500,6 +5675,52 @@ "lodash._root": "3.0.1" } }, + "log-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.0.0.tgz", + "integrity": "sha512-ValCSal2pRxRbet7O69a/1g5fZ2MLxf1YXIslNrdJF42ofY9zVf6MTqTwfhG+2x168xrbZATCgFQfXAwdNHv+w==", + "dev": true, + "requires": { + "chalk": "2.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, "log4js": { "version": "0.6.38", "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", @@ -6295,19 +6516,25 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "dev": true + }, "phantomjs-prebuilt": { - "version": "2.1.14", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.14.tgz", - "integrity": "sha1-1T0xH8+30dCN2yQBRVjxGIxRbaA=", + "version": "2.1.15", + "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.15.tgz", + "integrity": "sha1-IPhugtM0nFBZF1J3RbekEeCLOQM=", "dev": true, "requires": { "es6-promise": "4.0.5", - "extract-zip": "1.5.0", + "extract-zip": "1.6.5", "fs-extra": "1.0.0", "hasha": "2.2.0", "kew": "0.7.0", "progress": "1.1.8", - "request": "2.79.0", + "request": "2.81.0", "request-progress": "2.0.1", "which": "1.2.14" }, @@ -7305,9 +7532,9 @@ } }, "react-json-view": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/react-json-view/-/react-json-view-1.12.0.tgz", - "integrity": "sha512-k12TdTzybOx0DCSI5kNE2WQntMrYIE1wI9DF3AzTHM9OG/QOguIa6Gk2h/IFoqR4kOyf9n3GMMq6OAcQ9qk7KA==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/react-json-view/-/react-json-view-1.12.1.tgz", + "integrity": "sha512-klz1PrwmMcX8tQuvutsoBOABqLtyLKudeXi9Pv0MkBF1Ja1d6JnXrZdYZxIH9WOdwLpCHA+7NnKsdFc/RGFBqg==", "requires": { "clipboard": "1.7.1", "flux": "3.1.3", @@ -7346,12 +7573,12 @@ } }, "react-router": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.1.2.tgz", - "integrity": "sha512-VyM87OP+GkijVkkOXJw39A9fKtFelLoZYYDxtELhpZefjYatxI2SUxZcImo/9Tv52rR9UnNJBPSBpVRQMdvi8A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.2.0.tgz", + "integrity": "sha512-DY6pjwRhdARE4TDw7XjxjZsbx9lKmIcyZoZ+SDO7SBJ1KUeWNxT22Kara2AC7u6/c2SYEHlEDLnzBCcNhLE8Vg==", "requires": { - "history": "4.6.3", - "hoist-non-react-statics": "1.2.0", + "history": "4.7.2", + "hoist-non-react-statics": "2.3.1", "invariant": "2.2.2", "loose-envify": "1.3.1", "path-to-regexp": "1.7.0", @@ -7370,14 +7597,16 @@ } }, "react-router-dom": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.1.2.tgz", - "integrity": "sha512-CU6pFlpfvIj/xi36rZAbUiN0x39241q+d5bAfJJLtlEqlM62F3zgyv5aERH9zesmKqyDBBp2kd85rkq9Mo/iNQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.2.2.tgz", + "integrity": "sha512-cHMFC1ZoLDfEaMFoKTjN7fry/oczMgRt5BKfMAkTu5zEuJvUiPp1J8d0eXSVTnBh6pxlbdqDhozunOOLtmKfPA==", "requires": { - "history": "4.6.3", + "history": "4.7.2", + "invariant": "2.2.2", "loose-envify": "1.3.1", "prop-types": "15.5.10", - "react-router": "4.1.2" + "react-router": "4.2.0", + "warning": "3.0.0" } }, "read-pkg": { @@ -7617,19 +7846,19 @@ } }, "request": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", - "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "dev": true, "requires": { "aws-sign2": "0.6.0", "aws4": "1.6.0", - "caseless": "0.11.0", + "caseless": "0.12.0", "combined-stream": "1.0.5", "extend": "3.0.1", "forever-agent": "0.6.1", "form-data": "2.1.4", - "har-validator": "2.0.6", + "har-validator": "4.2.1", "hawk": "3.1.3", "http-signature": "1.1.1", "is-typedarray": "1.0.0", @@ -7637,19 +7866,13 @@ "json-stringify-safe": "5.0.1", "mime-types": "2.1.16", "oauth-sign": "0.8.2", - "qs": "6.3.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.1.1", "stringstream": "0.0.5", "tough-cookie": "2.3.2", - "tunnel-agent": "0.4.3", + "tunnel-agent": "0.6.0", "uuid": "3.1.0" - }, - "dependencies": { - "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", - "dev": true - } } }, "request-progress": { @@ -7693,9 +7916,9 @@ "dev": true }, "resolve-pathname": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.1.0.tgz", - "integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", + "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" }, "restore-cursor": { "version": "1.0.1", @@ -8087,9 +8310,9 @@ "dev": true }, "source-map-support": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", - "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.17.tgz", + "integrity": "sha512-30c1Ch8FSjV0FwC253iftbbj0dU/OXoSg1LAEGZJUlGgjTNj6cu+DVqJWWIZJY5RXLWV4eFtR+4ouo0VIOYOTg==", "dev": true, "requires": { "source-map": "0.5.6" @@ -8547,10 +8770,13 @@ "dev": true }, "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } }, "tweetnacl": { "version": "0.14.5", @@ -8784,9 +9010,9 @@ } }, "value-equal": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.2.1.tgz", - "integrity": "sha1-wiCjBDYfzmmU277ao8fhobiVhx0=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", + "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" }, "vary": { "version": "1.1.1", diff --git a/monkey_island/cc/ui/package.json b/monkey_island/cc/ui/package.json index 489eb7691..11f7862e7 100644 --- a/monkey_island/cc/ui/package.json +++ b/monkey_island/cc/ui/package.json @@ -22,10 +22,10 @@ "keywords": [], "author": "Your name here", "devDependencies": { - "babel-core": "^6.25.0", + "babel-core": "^6.26.0", "babel-eslint": "^6.0.0", "babel-loader": "^6.4.1", - "babel-polyfill": "^6.3.14", + "babel-polyfill": "^6.26.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-preset-stage-0": "^6.5.0", @@ -39,11 +39,11 @@ "file-loader": "^0.9.0", "glob": "^7.0.0", "isparta-instrumenter-loader": "^1.0.0", - "karma": "^1.0.0", + "karma": "^1.7.1", "karma-chai": "^0.1.0", "karma-coverage": "^1.0.0", "karma-mocha": "^1.0.0", - "karma-mocha-reporter": "^2.0.0", + "karma-mocha-reporter": "^2.2.4", "karma-phantomjs-launcher": "^1.0.0", "karma-sourcemap-loader": "^0.3.5", "karma-webpack": "^1.7.0", @@ -51,7 +51,7 @@ "mocha": "^3.0.0", "null-loader": "^0.1.1", "open": "0.0.5", - "phantomjs-prebuilt": "^2.0.0", + "phantomjs-prebuilt": "^2.1.15", "react-addons-test-utils": "^15.0.0", "react-hot-loader": "^1.2.9", "rimraf": "^2.4.3", @@ -62,7 +62,7 @@ }, "dependencies": { "bootstrap": "^3.3.7", - "core-js": "^2.0.0", + "core-js": "^2.5.1", "fetch": "^1.1.0", "normalize.css": "^4.0.0", "prop-types": "^15.5.10", @@ -75,8 +75,8 @@ "react-fa": "^4.2.0", "react-graph-vis": "^0.1.3", "react-json-tree": "^0.10.9", - "react-json-view": "^1.12.0", + "react-json-view": "^1.12.1", "react-jsonschema-form": "^0.49.0", - "react-router-dom": "^4.1.2" + "react-router-dom": "^4.2.2" } } diff --git a/monkey_island/cc/ui/src/components/pages/FullLogsPage.js b/monkey_island/cc/ui/src/components/pages/FullLogsPage.js index 3b115464e..cd6cef83c 100644 --- a/monkey_island/cc/ui/src/components/pages/FullLogsPage.js +++ b/monkey_island/cc/ui/src/components/pages/FullLogsPage.js @@ -29,7 +29,7 @@ const RowRenderer = React.createClass({ // // render() { // return ( - //
+ //
// // this.row = node } {...this.props}/> //
diff --git a/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js b/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js index 2baf7245d..46bbdc115 100644 --- a/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js +++ b/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js @@ -7,8 +7,8 @@ class RunMonkeyPageComponent extends React.Component { constructor(props) { super(props); this.state = { - ip: '0.0.0.0', - cmd: '-', + ips: [], + selectedIp: '0.0.0.0', isRunning: true }; } @@ -17,8 +17,8 @@ class RunMonkeyPageComponent extends React.Component { fetch('/api') .then(res => res.json()) .then(res => this.setState({ - ip: res.ip, - cmd: this.generateCmd(res.ip) + ips: res['ip_addresses'], + selectedIp: res['ip_addresses'][0] })); fetch('/api/local-monkey') @@ -32,33 +32,52 @@ class RunMonkeyPageComponent extends React.Component { return `curl http://${ip}:5000/get-monkey | sh`; } - runLocalMonkey() { - fetch('/api/local-monkey/run', {method: 'POST'}) + runLocalMonkey = () => { + fetch('/api/local-monkey', + { + method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: JSON.stringify({action: 'run', ip: this.state.selectedIp}) + }) .then(res => res.json()) .then(res => { this.setState({ isRunning: res['is_running'] }); }); - } + }; + + setSelectedIp = (event) => { + this.setState({selectedIp: event.target.value}); + }; render() { return (

Run the Monkey

+

+ Select one of the server's IP addresses: + +
That address will be used as the monkey's C&C address. +

Run this snippet on a host for manually infecting it with a Monkey:

- + - {this.state.cmd} + {this.generateCmd(this.state.selectedIp)}

- Or simply click here to Run on {this.state.ip} + style={{'marginLeft': '0.2em'}}>Run on {this.state.selectedIp} { this.state.isRunning ? Running... : ''} diff --git a/monkey_island/cc/ui/src/components/pages/RunServerPage.js b/monkey_island/cc/ui/src/components/pages/RunServerPage.js index dfa152809..c94f78b9c 100644 --- a/monkey_island/cc/ui/src/components/pages/RunServerPage.js +++ b/monkey_island/cc/ui/src/components/pages/RunServerPage.js @@ -11,7 +11,7 @@ class RunServerPageComponent extends React.Component { componentDidMount() { fetch('/api') .then(res => res.json()) - .then(res => this.setState({ip: res.ips.join(', ')})); + .then(res => this.setState({ip: res['ip_addresses'][0]})); } render() { diff --git a/monkey_island/cc/ui/src/styles/App.css b/monkey_island/cc/ui/src/styles/App.css index 9b6f4c28e..fdb617c7a 100644 --- a/monkey_island/cc/ui/src/styles/App.css +++ b/monkey_island/cc/ui/src/styles/App.css @@ -140,6 +140,16 @@ body { background: #666; } +/* + * Run Monkey Page + */ + +.inline-select { + display: inline-block !important; + width: 130px !important; + margin-left: 1em; +} + /* * Map Preview Pane */