branch develop updated (53db6d5 -> 9e5ed0d)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository mum. See http://git.chorem.org/mum.git from 53db6d5 hostpage : launch full detection => OK new 5f7ad39 ssh se connecte avec clé publique new 0e6b0d9 bonne version de angular-toastr pour les dépendances new 9e5ed0d hostpage: remove this host => OK The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 9e5ed0d204b9183f8f94e84bd53a763c76a570b0 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 16:22:04 2015 +0100 hostpage: remove this host => OK commit 0e6b0d90d1153bba3f1df200a1086548275c7908 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 15:36:01 2015 +0100 bonne version de angular-toastr pour les dépendances commit 5f7ad39638f9ef3ed0f2e850acd5d962297cb728 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 15:17:46 2015 +0100 ssh se connecte avec clé publique Summary of changes: app/app.py | 1 + app/modules/connection_modules/ssh.py | 3 +-- app/modules/storage_modules/shelve_db.py | 12 ++++++++---- app/process_monitoring.py | 9 +++++++-- bower.json | 5 +++-- static/js/controllers/hostPageCtrl.js | 6 ++++++ views/hostpage.html | 4 +++- 7 files changed, 29 insertions(+), 11 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 5f7ad39638f9ef3ed0f2e850acd5d962297cb728 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 15:17:46 2015 +0100 ssh se connecte avec clé publique --- app/modules/connection_modules/ssh.py | 3 +-- views/hostpage.html | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/modules/connection_modules/ssh.py b/app/modules/connection_modules/ssh.py index ce3c576..7c6cabf 100644 --- a/app/modules/connection_modules/ssh.py +++ b/app/modules/connection_modules/ssh.py @@ -13,12 +13,11 @@ class SSH: self.CommandNotFoundException = cnfe if params is not None: key_path = str(key_loc) + str(params['public_key']) - key = paramiko.RSAKey.from_private_key_file(key_path) self.ssh = paramiko.SSHClient() self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.ssh.connect(addr_host, username=params['username'], - pkey=key, + key_filename=key_path, port=params['port']) def get_name(self): diff --git a/views/hostpage.html b/views/hostpage.html index 3e67cce..ce79874 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -232,6 +232,8 @@ <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>.
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 0e6b0d90d1153bba3f1df200a1086548275c7908 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 15:36:01 2015 +0100 bonne version de angular-toastr pour les dépendances --- app/app.py | 2 +- bower.json | 5 +++-- static/js/controllers/headCtrl.js | 4 ++++ views/index.html | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/app.py b/app/app.py index 3f2df3d..ea5f78c 100755 --- a/app/app.py +++ b/app/app.py @@ -174,6 +174,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/bower.json b/bower.json index 2b7c589..dfcc7f0 100644 --- a/bower.json +++ b/bower.json @@ -4,13 +4,14 @@ "dependencies": { "bootstrap": "~3.2.0", "angular": "~1.2.28", - "angular-toastr": "~0.5.2", + "angular-toastr": "0.4.2", "angular-route": "~1.2.28", "angular-bootstrap": "~0.12.1", "angular-sanitize": "~1.2.28", "angular-file-upload": "~1.1.5" }, "resolutions": { - "angular": "~1.2.28" + "angular": "~1.2.28", + "angular-toastr": "0.4.2" } } diff --git a/static/js/controllers/headCtrl.js b/static/js/controllers/headCtrl.js index f1467c7..65f331c 100644 --- a/static/js/controllers/headCtrl.js +++ b/static/js/controllers/headCtrl.js @@ -82,6 +82,10 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r }; + $scope.toto = function(){ + $scope.pop_success("abwabwa", "trololo") + } + $scope.pop_success = function(title, msg){ toastr.success(msg, title); }; diff --git a/views/index.html b/views/index.html index 1bb2ed5..a4c5dab 100644 --- a/views/index.html +++ b/views/index.html @@ -55,6 +55,7 @@ <p class="navbar-text navbar-left"><a href="#dashboard/success" style="color:green">OK : {{stateNumber()[0]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/warning" style="color:orange">Warning : {{stateNumber()[1]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/danger" style="color:red">KO : {{stateNumber()[2]}}</a></p> + <button type="button" class="btn btn-primary btn-xs" ng-click="toto()">tut</button> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 9e5ed0d204b9183f8f94e84bd53a763c76a570b0 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 16:22:04 2015 +0100 hostpage: remove this host => OK --- app/app.py | 3 ++- app/modules/storage_modules/shelve_db.py | 12 ++++++++---- app/process_monitoring.py | 9 +++++++-- static/js/controllers/headCtrl.js | 4 ---- static/js/controllers/hostPageCtrl.js | 6 ++++++ views/hostpage.html | 2 +- views/index.html | 1 - 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/app.py b/app/app.py index ea5f78c..bea6da4 100755 --- a/app/app.py +++ b/app/app.py @@ -130,6 +130,7 @@ def receive(ws): start_first_detection(msg["NMAP_SCAN_DEMAND"], ml, ws) elif code == "LAUNCH_FULL_DETECTION": ml.run_all_detection_modules(msg["LAUNCH_FULL_DETECTION"]) + ws.send(json_dumps({"SUCCESS_MODULE": "Full detection"})) elif code == "GET_HOSTS": db = ml.get_db() ws.send(json.dumps({"RES_GET_HOSTS": db.get_hosts()})) @@ -174,6 +175,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/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index ce7bf7a..87b47ff 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -391,14 +391,18 @@ class shelve_db: self.close_db() return json.dumps(res) - def remove_host(self, addr_host): + def remove_host(self, args): """ - Removes from the database the host at the adress on parameter. If the host is part of a group, it will be - removed of this group as well. - :param addr_host: the IP address of the host to delete + Removes a host from the database. All the monitoring intructions concerning this host will be deleted. + Finally, if the host is part of a group, it will be also removed from these groups. + :param args: A dictionary containing: + {'addr_host': val} """ + addr_host = args['addr_host'] self.open_db() try: + # removing monitoring instructions for this host + self.rem_to_monitoring_list(addr_host, None) # removing monitoring entries for this host if addr_host in self.db['hosts']: del self.db['hosts'][addr_host] diff --git a/app/process_monitoring.py b/app/process_monitoring.py index ffc51a8..357613b 100644 --- a/app/process_monitoring.py +++ b/app/process_monitoring.py @@ -80,8 +80,13 @@ def add_to_waiting_list(dict_mod): def remove_to_waiting_list(addr_host, modname): global waiting_list for i in range(len(waiting_list)): - if waiting_list[i]['addr'] == addr_host and waiting_list[i]['mod_name'] == modname: - waiting_list.pop(i) + if waiting_list[i]['addr'] == addr_host: + if modname is None: + # it was asked to remove all entries of this host + waiting_list.pop(i) + elif waiting_list[i]['mod_name'] == modname: + # we remove only the necessary module from the list + waiting_list.pop(i) class RunMonitoring(threading.Thread): def __init__(self, list_dict_mod, ml, wsc): diff --git a/static/js/controllers/headCtrl.js b/static/js/controllers/headCtrl.js index 65f331c..f1467c7 100644 --- a/static/js/controllers/headCtrl.js +++ b/static/js/controllers/headCtrl.js @@ -82,10 +82,6 @@ mumApp.controller('headCtrl', function($scope, $rootScope, toastr, $interval, $r }; - $scope.toto = function(){ - $scope.pop_success("abwabwa", "trololo") - } - $scope.pop_success = function(title, msg){ toastr.success(msg, title); }; diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 8bb2a78..43771cc 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -79,6 +79,12 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_custom_informations', 'args': args}})); }; + $scope.remove_host = function(){ + args = {}; + args['addr_host'] = $scope.addr_host; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'remove_host', 'args': args}})); + } + // creation of modals $scope.open_modal_conf = function (mod_name) { var modalInstance = $modal.open({ diff --git a/views/hostpage.html b/views/hostpage.html index ce79874..c2cf6e7 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -4,7 +4,7 @@ <button type="button" class="btn btn-primary btn-xs" ng-click="open_modal_block()">Activate/Deactivate</button> <button type="button" class="btn btn-primary btn-xs" ng-click="open_modal_conn()">Connection settings</button> <button type="button" class="btn btn-info btn-xs" ng-click="launch_detection()">Launch a full detection</button> - <button type="button" class="btn btn-danger btn-xs" ng-click="call_func('remove_host', [addr_host])">Remove this host</button> + <button type="button" class="btn btn-danger btn-xs" ng-click="remove_host()">Remove this host</button> <table class="table table-condensed table-hover"> <thead> diff --git a/views/index.html b/views/index.html index a4c5dab..1bb2ed5 100644 --- a/views/index.html +++ b/views/index.html @@ -55,7 +55,6 @@ <p class="navbar-text navbar-left"><a href="#dashboard/success" style="color:green">OK : {{stateNumber()[0]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/warning" style="color:orange">Warning : {{stateNumber()[1]}}</a></p> <p class="navbar-text navbar-left"><a href="#dashboard/danger" style="color:red">KO : {{stateNumber()[2]}}</a></p> - <button type="button" class="btn btn-primary btn-xs" ng-click="toto()">tut</button> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm