diff --git a/monkey_island/cc/admin/ui/index.html b/monkey_island/cc/admin/ui/index.html index c795dae69..c1105ebd5 100644 --- a/monkey_island/cc/admin/ui/index.html +++ b/monkey_island/cc/admin/ui/index.html @@ -136,27 +136,27 @@
- - -
+
- - - - + + + +
diff --git a/monkey_island/cc/admin/ui/js/monkeys-admin.js b/monkey_island/cc/admin/ui/js/monkeys-admin.js index 6c8d671fb..8867f064d 100644 --- a/monkey_island/cc/admin/ui/js/monkeys-admin.js +++ b/monkey_island/cc/admin/ui/js/monkeys-admin.js @@ -28,7 +28,7 @@ const ICONS_EXT = ".png"; var focusedOnNode = false; var monkeyCfg = undefined; -var generalCfg = undefined; +var newCfg = undefined; var telemTable = undefined; JSONEditor.defaults.theme = 'bootstrap3'; @@ -74,7 +74,7 @@ function initAdmin() { disable_edit_json: false, }); - generalCfg = new JSONEditor(document.getElementById('general-config'),{ + newCfg = new JSONEditor(document.getElementById('new-config'),{ schema: { type: "object", title: "New Monkeys", @@ -90,7 +90,7 @@ function initAdmin() { }, disable_edit_json: false, }); - generalCfg.setValue({alive: true}); + newCfg.setValue({alive: true}); telemTable = $("#telemetris-table").DataTable({ "ordering": false, @@ -336,11 +336,11 @@ function toggleFocusOnNode() { } } -function loadGeneralConfig() { - $.getJSON('/api/config/general', function(json) { +function loadNewMonkeysConfig() { + $.getJSON('/api/config/new', function(json) { if (jQuery.isEmptyObject(json)) { - generalCfg.setValue({alive: true}); + newCfg.setValue({alive: true}); } else { @@ -349,31 +349,31 @@ function loadGeneralConfig() { json.alive = true; } delete json.id; - generalCfg.setValue(json); + newCfg.setValue(json); } }); } -function updateGeneralConfig() { - var curr_config = generalCfg.getValue() +function updateNewMonkeysConfig() { + var curr_config = newCfg.getValue() $.ajax({ headers : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' }, - url : '/api/config/general', + url : '/api/config/new', type : 'POST', data : JSON.stringify(curr_config), success : function(response, textStatus, jqXhr) { - console.log("General config successfully updated!"); + console.log("New monkeys config successfully updated!"); }, error : function(jqXHR, textStatus, errorThrown) { // log the error to the console console.log("The following error occured: " + textStatus, errorThrown); }, complete : function() { - console.log("Sending general config update..."); + console.log("Sending new monkeys config update..."); } }); } diff --git a/monkey_island/cc/main.py b/monkey_island/cc/main.py index e38d06c4d..6804fd89c 100644 --- a/monkey_island/cc/main.py +++ b/monkey_island/cc/main.py @@ -90,12 +90,12 @@ class Monkey(restful.Resource): monkey_json['modifytime'] = datetime.now() - # if new monkey, change config according to general config. + # if new monkey, change config according to "new monkeys" config. db_monkey = mongo.db.monkey.find_one({"guid": monkey_json["guid"]}) if not db_monkey: - general_config = mongo.db.config.find_one({'name' : 'generalconfig'}) or {} + new_config = mongo.db.config.find_one({'name' : 'newconfig'}) or {} monkey_json['config'] = monkey_json.get('config', {}) - monkey_json['config'].update(general_config) + monkey_json['config'].update(new_config) else: db_config = db_monkey.get('config', {}) if db_config.has_key('current_server'): @@ -157,16 +157,16 @@ class Telemetry(restful.Resource): return mongo.db.telemetry.find_one_or_404({"_id": telem_id}) -class GeneralConfig(restful.Resource): +class NewConfig(restful.Resource): def get(self): - config = mongo.db.config.find_one({'name' : 'generalconfig'}) or {} + config = mongo.db.config.find_one({'name' : 'newconfig'}) or {} if config.has_key('name'): del config['name'] return config def post(self): config_json = json.loads(request.data) - return mongo.db.config.update({'name' : 'generalconfig'}, {"$set" : config_json}, upsert=True) + return mongo.db.config.update({'name' : 'newconfig'}, {"$set" : config_json}, upsert=True) class MonkeyDownload(restful.Resource): @@ -234,7 +234,7 @@ api.representations = DEFAULT_REPRESENTATIONS api.add_resource(Root, '/api') api.add_resource(Monkey, '/api/monkey', '/api/monkey/', '/api/monkey/') api.add_resource(Telemetry, '/api/telemetry', '/api/telemetry/', '/api/telemetry/') -api.add_resource(GeneralConfig, '/api/config/general') +api.add_resource(NewConfig, '/api/config/new') api.add_resource(MonkeyDownload, '/api/monkey/download', '/api/monkey/download/', '/api/monkey/download/') if __name__ == '__main__':