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 50c9f8cf9b5c9c9796fef9086adbd47306d3488b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 23 11:36:22 2015 +0200 new nmap params for UDP port of snmp detection + corrected init_conn + using telnetlib for smtp check --- app/module_loader.py | 1 + app/modules/monitoring_modules/http.py | 2 +- app/modules/monitoring_modules/smtp.py | 6 +++--- app/modules/nmap_detection.py | 6 +++++- app/modules/storage_modules/shelve_db.py | 21 ++++++++++++++++++--- static/js/controllers/scanCtrl.js | 2 +- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/module_loader.py b/app/module_loader.py index 174ce9c..bd78d61 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -27,6 +27,7 @@ class ModuleLoader: def __init__(self, conf): self.conf = conf self.db = self.load_db(self.conf['keys_location']) + self.db.reset_tasks() self.loaded_mod_moni = {} # See load_all_monitoring_modules self.loaded_mod_detect = {} # See load_all_detection_modules self.loaded_mod_conn = {} # See load_all_connection_modules diff --git a/app/modules/monitoring_modules/http.py b/app/modules/monitoring_modules/http.py index 97c5b0a..8ba058f 100644 --- a/app/modules/monitoring_modules/http.py +++ b/app/modules/monitoring_modules/http.py @@ -27,4 +27,4 @@ def check(addr_host, port_list, cnfe): raise exception_inst return res_http_check except urllib2.URLError: - res_http_check = False \ No newline at end of file + return False \ No newline at end of file diff --git a/app/modules/monitoring_modules/smtp.py b/app/modules/monitoring_modules/smtp.py index d5d37a9..253d5bc 100644 --- a/app/modules/monitoring_modules/smtp.py +++ b/app/modules/monitoring_modules/smtp.py @@ -1,6 +1,6 @@ __author__ = 'aguilbaud' -import smtplib +import telnetlib compatible_os = ["all"] block = "network" @@ -16,7 +16,7 @@ def check(addr_host, port_list, cnfe): for i in range(len(port_list)): if port_list[i]['portname'] == part: smtp_port_found = True - smtplib.SMTP(addr_host, str(port_list[i]['portid']), None, 10) + res_smtp_check = telnetlib.Telnet(addr_host, int(port_list[i]['portid']), 10).read_some() != "" if not smtp_port_found: exception_inst = getattr(cnfe, "CommandNotFoundException")( part, addr_host @@ -24,4 +24,4 @@ def check(addr_host, port_list, cnfe): raise exception_inst return res_smtp_check except Exception: - res_smtp_check = False \ No newline at end of file + return False \ No newline at end of file diff --git a/app/modules/nmap_detection.py b/app/modules/nmap_detection.py index 532d2db..873ed6a 100644 --- a/app/modules/nmap_detection.py +++ b/app/modules/nmap_detection.py @@ -122,7 +122,11 @@ class nmap_detection: # save directly it on the database def parse_res(self, ip): # opening the xml file with minidom parser - root = minidom.parse(self.filename) + try: + root = minidom.parse(self.filename) + except IOError: + exception_inst = getattr(self.HostNotFoundException, "HostNotFoundException")(ip) + raise exception_inst pexpect.run("rm -f " + self.filename) collection = root.documentElement diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 0b3662b..16aa2ed 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -51,6 +51,15 @@ class shelve_db: self.db = None self.lock.release() + def reset_tasks(self): + self.open_db() + try: + self.db['tasks'] = [] + except Exception: + print traceback.format_exc() + finally: + self.close_db() + def init_global_conf(self, loaded_mod_moni): """ This method is executed once at each launch of the application. @@ -217,9 +226,15 @@ class shelve_db: if port["portname"] in conn_infos: # if this open port is part of the loaded connections dict_conn[port["portname"]] = {} - for param in conn_infos[port["portname"]]['params']: - dict_conn[port["portname"]][param] = None - dict_conn[port["portname"]]["priority"] = 0 + if len(conn_infos[port['portname']]['params'].keys()) == 1 and \ + 'port' in conn_infos[port['portname']]['params']: + # if there is only the port to configure, the conn module can be activated because is + # already configured + dict_conn[port["portname"]]["priority"] = 1 + else: + for param in conn_infos[port["portname"]]['params']: + dict_conn[port["portname"]][param] = None + dict_conn[port["portname"]]["priority"] = 0 dict_conn[port["portname"]]["port"] = int(port["portid"]) else: for loaded_conn_mod in conn_infos: diff --git a/static/js/controllers/scanCtrl.js b/static/js/controllers/scanCtrl.js index 6b3e306..d30ae6d 100644 --- a/static/js/controllers/scanCtrl.js +++ b/static/js/controllers/scanCtrl.js @@ -8,7 +8,7 @@ mumApp.controller('scanCtrl', function($scope, $rootScope) { $scope.show_opt = false; - $scope.nmap_options = "-A -Pn --unprivileged"; + $scope.nmap_options = "-sU -sS -p U:161,T:1-8080,61209 -A -Pn"; $scope.$on("success", function (event, args) { $scope.state = "Success!"; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.