This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit c56fa15b580d3954827d2c147cbc23656cc997d6 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 17:11:57 2015 +0100 upload minimaliste possible pour les clés --- app/app.py | 13 +++++++++---- app/module_loader.py | 3 +++ static/js/controllers/headCtrl.js | 3 +++ views/hostpage.html | 24 ++++++++++++++---------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/app.py b/app/app.py index bea6da4..eda7db5 100755 --- a/app/app.py +++ b/app/app.py @@ -159,11 +159,16 @@ def receive(ws): except WebSocketError: # Should be WebSocketError when closing the connection wsc.remove_websocket(ws) break -""" + @route('/upload', method='POST') def do_upload(): - upload.save(path) -""" + upload = request.files.get('upload') + try: + upload.save(ml.get_public_keys_loc() + upload.filename) + return 'Upload done! <a href="/">Back to dashboard.</a>' + except IOError: + return 'This file already exists. <a href="/">Back to dashboard.</a>' + # Lancement du serveur a l'adresse 0.0.0.0:1337 @@ -175,6 +180,6 @@ if __name__ == '__main__': ml.load_all_connection_modules() ml.load_all_detection_modules() wsc = WebSocketContainer(ml.get_db()) - process_monitoring.init(ml, wsc) + #process_monitoring.init(ml, wsc) port = int(os.environ.get('PORT', 1337)) run(host='0.0.0.0', port=port, debug=True, server=GeventWebSocketServer) \ No newline at end of file diff --git a/app/module_loader.py b/app/module_loader.py index c1a587c..7b8d136 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -49,6 +49,9 @@ class ModuleLoader: def get_db(self): return self.db + def get_public_keys_loc(self): + return self.public_keys_loc + @staticmethod def run_nmap_detection(param, opt, db, ws, list_mod_conn, dict_mod_monitoring): """ diff --git a/static/js/controllers/headCtrl.js b/static/js/controllers/headCtrl.js index f1467c7..a492dd0 100644 --- a/static/js/controllers/headCtrl.js +++ b/static/js/controllers/headCtrl.js @@ -29,6 +29,7 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r case "SUCCESS_MODULE": // Success of a module execution $rootScope.$broadcast("success", value); toastr.success(value, "Success on module execution"); + break; case "RES_INFO_HOST": // Informations concerning one host $rootScope.$broadcast("hostInfos", JSON.parse(value)); break; @@ -44,6 +45,7 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r break; case "RES_GET_LOADED_MONI_MOD": $rootScope.$broadcast("resGetLoadedMoniMod", JSON.parse(value)); + break; case "RES_CALL_FUNC_DB": // Get a result after calling a funcion on the db $rootScope.$broadcast("resCall", JSON.parse(value)); break; @@ -72,6 +74,7 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r break; case "KEYS_LIST": $rootScope.$broadcast("keysList", JSON.parse(value)); + break; case "ERROR": toastr.error(value, "Server error"); break; diff --git a/views/hostpage.html b/views/hostpage.html index c2cf6e7..c7c53f3 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -149,8 +149,6 @@ <h3 class="modal-title">Connection configuration</h3> </div> <div class="modal-body"> - {{current_config}} - {{priorities}} <form> <div class="form-group"> <h3>Choose the priority of each avaliable connection</h3> @@ -191,7 +189,6 @@ </div> <div class="modal-body"> - {{loaded_conn_mods}} <!--<input type="file" nv-file-select uploader="uploader"/><br/> <ul> <li ng-repeat="item in uploader.queue"> @@ -200,15 +197,24 @@ </li> </ul>--> <div class="row"> - <div class="col-xs-2"> - <label for="port">Port used</label> - <input type="number" id="port" min="0" ng-model="port"> + <div class="col-xs-3"> + <label for="public_key">Select a public key</label> + <select class="form-control input-sm" id="public_key" ng-model="public_key" ng-options="key as key for key in keys_list"></select> + </div> + </div> + <div class="row"> + <div class="col-xs-3"> + <form action="/upload" method="post" enctype="multipart/form-data"> + <label for="upload_key">Or upload a new public key:</label> + <input type="file" id="upload_key" name="upload" /> + <input type="submit" value="Start upload" /> + </form> </div> </div> <div class="row"> <div class="col-xs-2"> - <label for="public_key">Select a public key</label> - <select class="form-control input-sm" id="public_key" ng-model="public_key" ng-options="key as key for key in keys_list"></select> + <label for="port">Port used</label> + <input type="number" id="port" min="0" ng-model="port"> </div> </div> <div class="row"> @@ -232,8 +238,6 @@ <h3 class="modal-title">Activate/Deactivate monitoring blocks</h3> </div> <div class="modal-body"> - {{loaded_moni_mod}} - {{blocks}} <table class="table table-bordered table-hover"> <tr ng-repeat-start="(blockname, block) in blocks"> <th>{{blockname}}</th> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.