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 53db6d574b84884f134d1ea1d85d6a8847e2fe36 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Mar 12 14:52:21 2015 +0100 hostpage : launch full detection => OK --- app/app.py | 4 +++- app/module_loader.py | 8 +++----- app/modules/connection_modules/ssh.py | 1 - static/js/controllers/hostPageCtrl.js | 8 ++++++-- views/hostpage.html | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/app.py b/app/app.py index c37b3c5..3f2df3d 100755 --- a/app/app.py +++ b/app/app.py @@ -128,6 +128,8 @@ def receive(ws): for code in msg: if code == "NMAP_SCAN_DEMAND": start_first_detection(msg["NMAP_SCAN_DEMAND"], ml, ws) + elif code == "LAUNCH_FULL_DETECTION": + ml.run_all_detection_modules(msg["LAUNCH_FULL_DETECTION"]) elif code == "GET_HOSTS": db = ml.get_db() ws.send(json.dumps({"RES_GET_HOSTS": db.get_hosts()})) @@ -172,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/app/module_loader.py b/app/module_loader.py index 3eca78e..c1a587c 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -89,7 +89,6 @@ class ModuleLoader: Instanciates and stores the informations about each monitoring modules avaliable on the loaded_mod_detect attribute """ for importer, mod_name, ispkg in pkgutil.iter_modules(["app/modules/detection_modules/"]): - print mod_name if mod_name not in sys.modules and not mod_name == 'nmap_detection': try: loaded_mod = __import__("modules.detection_modules." + mod_name, fromlist=[mod_name]) @@ -102,7 +101,6 @@ class ModuleLoader: self.loaded_mod_detect[mod_name] = infos_mod except AttributeError: print "Error : internal detection module " + mod_name + " could not have been loaded. " - print self.loaded_mod_detect def run_all_detection_modules(self, addr_host): """ @@ -113,10 +111,10 @@ class ModuleLoader: conn = self.create_connection(addr_host) if conn is not None: for mod_name in self.loaded_mod_detect: - mod_inst = getattr(self.loaded_mod_moni[mod_name]['imported'], - self.loaded_mod_moni[mod_name]['class_name'])(conn, db) + mod_inst = getattr(self.loaded_mod_detect[mod_name]['imported'], + self.loaded_mod_detect[mod_name]['class_name'])(conn, db) try: - mod_inst.check() + mod_inst.run_detection() except modules.ModuleNotCompatibleException.ModuleNotCompatibleException as mnce: print mnce.__str__() except modules.CommandNotFoundException.CommandNotFoundException as cnfe: diff --git a/app/modules/connection_modules/ssh.py b/app/modules/connection_modules/ssh.py index 8806756..ce3c576 100644 --- a/app/modules/connection_modules/ssh.py +++ b/app/modules/connection_modules/ssh.py @@ -13,7 +13,6 @@ class SSH: self.CommandNotFoundException = cnfe if params is not None: key_path = str(key_loc) + str(params['public_key']) - print key_path key = paramiko.RSAKey.from_private_key_file(key_path) self.ssh = paramiko.SSHClient() self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index a009be5..8bb2a78 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -49,6 +49,10 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo return($scope.addr_host); }; + $scope.launch_detection = function(){ + $rootScope.$broadcast("sendViaWs", JSON.stringify({"LAUNCH_FULL_DETECTION": $scope.addr_host})); + } + // receiving the host informations $scope.$on("hostInfos", function (event, args) { $scope.$apply(function(){ @@ -57,7 +61,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo }); }); - // monitoring data are updated + /* // monitoring data are updated $scope.$on("hostsUpdate", function (event, args) { $scope.$apply(function(){ for(i=0 ; i<args.length()) ; i++){ @@ -65,7 +69,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo $scope.items['monitoring'] = args['monitoring']; } }); - }); + });*/ // save custom informations $scope.save_custom_infos = function(){ diff --git a/views/hostpage.html b/views/hostpage.html index 2286641..3e67cce 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -3,7 +3,7 @@ <h1 class="page-header">Current state of {{addr_host}} <small>{{items.hostname}}</small></h1> <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">Launch a new detection</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> <table class="table table-condensed table-hover"> <thead> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.