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 34f72679048bc828c3844403b16a8b40a557a3b6 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Feb 23 16:38:05 2015 +0100 scanned ip printed after scan --- app/app.py | 3 ++- app/modules/detection_modules/nmap_detection.py | 1 - app/modules/storage_modules/shelve_db.py | 12 ++++++------ static/js/controllers/detectCtrl.js | 1 + views/scan.html | 1 + 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/app.py b/app/app.py index ba84339..0e9f74f 100755 --- a/app/app.py +++ b/app/app.py @@ -25,6 +25,7 @@ BROWSER_NOTIFICATION = "31" ERROR = "40" + # Pour lancer la detection nmap avec un nouveau thread class ThreadDetect(threading.Thread): def __init__(self, ip_range, ws): @@ -134,7 +135,7 @@ def receive(ws): del db else: break - except: + except: # Should be WebSocketError when closing the connection break diff --git a/app/modules/detection_modules/nmap_detection.py b/app/modules/detection_modules/nmap_detection.py index eb9bf21..7d77fb5 100644 --- a/app/modules/detection_modules/nmap_detection.py +++ b/app/modules/detection_modules/nmap_detection.py @@ -142,7 +142,6 @@ class nmap_detection: list_dict_port.append(dict_port) dict_host['openports'] = list_dict_port # the host have its IP for ID on the db - print dict_host self.db.add_host(dict_host['addr'], json.dumps(dict_host), self.conn_mod_list) pexpect.run("rm -f res.xml") self.scanned_ip.append(ip) \ 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 968d379..00b1d88 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -275,21 +275,21 @@ class shelve_db: stats['M2'] += stats['delta'] * (val - stats['mean']) return stats - def create_global_conf(self, dict): + def create_global_conf(self, dict_mod_info): """ Create an entry on the global_conf for each new monitoring module. - :param dict: dictionary containing informations about all notification modules, by os, in the form: + :param dict_mod_info: dictionary containing informations about all notification modules, by os, in the form: [os_name][monitoring_module_name][{'block':val, 'unit': val}] """ self.open_db() try: - for os in dict: + for os in dict_mod_info: if os not in self.db['global_conf']: self.db['global_conf'][os] = {} - for mod in dict[os]: + for mod in dict_mod_info[os]: if mod not in self.db['global_conf'][os]: self.db['global_conf'][os][mod] = {} - self.db['global_conf'][os][mod]['block'] = dict[os][mod]['block'] + self.db['global_conf'][os][mod]['block'] = dict_mod_info[os][mod]['block'] self.db['global_conf'][os][mod]['activated'] = True self.db['global_conf'][os][mod]['check_frequency'] = 3600 self.db['global_conf'][os][mod]['nb_minute'] = 30 @@ -298,7 +298,7 @@ class shelve_db: self.db['global_conf'][os][mod]['nb_week'] = 2 self.db['global_conf'][os][mod]['nb_month'] = 6 self.db['global_conf'][os][mod]['nb_year'] = None - unit = dict[os][mod]['unit'] + unit = dict_mod_info[os][mod]['unit'] self.db['global_conf'][os][mod]['unit'] = unit if unit == '%': self.db['global_conf'][os][mod]['minor_limit'] = 95 diff --git a/static/js/controllers/detectCtrl.js b/static/js/controllers/detectCtrl.js index deed7f1..344182f 100644 --- a/static/js/controllers/detectCtrl.js +++ b/static/js/controllers/detectCtrl.js @@ -20,6 +20,7 @@ formExample.controller('DetectController', ['$scope', 'toastr', '$interval', fun case 20: // Success of a module execution $scope.$apply(function(){ $scope.state = "Success!"; + $scope.ip_scanned = value; }); toastr.success(value, "Success on module execution"); case 21: // Informations concerning one host diff --git a/views/scan.html b/views/scan.html index f879936..2ee59af 100644 --- a/views/scan.html +++ b/views/scan.html @@ -71,6 +71,7 @@ </div> <div ng-show="validated == true"> {{state}} + {{ip_scanned}} </div> </div> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.