branch develop updated (37e435d -> dca7d4d)
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 37e435d click on a link which is the current URL will now refresh the page + completing/harmonizing the comments new 639391c detection module open_ports_detection added + bug fix on init_conn: now the port is well pre-configured new 5175283 The conn modules must now specify which port it usually use. Then on init_conn, a connection is created if a open port of same number exists on the loaded conn mod new dca7d4d hostpage: removed useless function 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 dca7d4d9899a638ad0ca6ab43636af1f6fa622c3 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 18:36:39 2015 +0200 hostpage: removed useless function commit 5175283672a985cfd006a06a633dcf4834a09152 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 13:59:59 2015 +0200 The conn modules must now specify which port it usually use. Then on init_conn, a connection is created if a open port of same number exists on the loaded conn mod commit 639391c7338c194c33196c8ec6ed91a226f06687 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 11:07:28 2015 +0200 detection module open_ports_detection added + bug fix on init_conn: now the port is well pre-configured Summary of changes: README | 2 +- app/module_loader.py | 5 +++++ app/modules/connection_modules/ssh.py | 4 ++++ .../detection_modules/open_ports_detection.py | 26 ++++++++++++++++++++++ app/modules/storage_modules/shelve_db.py | 24 +++++++++++++++----- static/js/controllers/hostPageCtrl.js | 4 ---- 6 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 app/modules/detection_modules/open_ports_detection.py -- 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 639391c7338c194c33196c8ec6ed91a226f06687 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 11:07:28 2015 +0200 detection module open_ports_detection added + bug fix on init_conn: now the port is well pre-configured --- app/module_loader.py | 2 ++ .../detection_modules/open_ports_detection.py | 26 ++++++++++++++++++++++ app/modules/storage_modules/shelve_db.py | 11 ++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/module_loader.py b/app/module_loader.py index 6841807..0e89ef1 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -81,8 +81,10 @@ class ModuleLoader: modules.HostNotFoundException) try: if re.search('^\d{1,3}(-\d{1,3})?[.]\d{1,3}(-\d{1,3})?[.]\d{1,3}(-\d{1,3})?[.]\d{1,3}(-\d{1,3})?$', param): + # the parameter is an IP range ip_range = nmap_mod_instance.check_ip_range(param) else: + # the parameter is not an IP range, so we considere it as an hostname. ip_range = nmap_mod_instance.launch_detection_with_hostname(param) return ip_range except modules.HostNotFoundException.HostNotFoundException as hnfe: diff --git a/app/modules/detection_modules/open_ports_detection.py b/app/modules/detection_modules/open_ports_detection.py new file mode 100644 index 0000000..9a39bc5 --- /dev/null +++ b/app/modules/detection_modules/open_ports_detection.py @@ -0,0 +1,26 @@ +__author__ = 'aguilbaud' +import json + +compatible_os = ['linux', 'unix'] + + +def run_detection(conn, db): + cmd = "netstat -tuln" + stdout = conn.exec_command(cmd) + dict_total = {} + l_number = 0 + for line in stdout.splitlines(): + # we ignore the first 2 lines which contains no information + if l_number < 2: + l_number += 1 + else: + fields = line.split() + if fields[0] not in dict_total: + dict_total[fields[0]] = [] + """ + ip_fields = fields[3].split(':') # x.x.x.x:port if IPv4, :::port if IPv6 + port_number = ip_fields[len(ip_fields) - 1] + dict_total[fields[0]].append(port_number) + """ + dict_total[fields[0]].append(fields[3]) + db.save_detection(conn.get_addr_host(), "open_ports_detection", json.dumps(dict_total)) \ 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 98487f8..01f1f78 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -196,17 +196,18 @@ class shelve_db: 'params': {param1: type1, param2: type2, ...} } } - :return: + :return: a dictionary containing: + {conn_mod_name: {'priority': int, 'port': int, param1: None, param2: None, ...}, ...} """ dict_conn = {} for port in dict_nmap_res['openports']: if port["portname"] in conn_infos: - dict_conn[port["portname"]] = { - "priority": 0, - "port": int(port["portid"]) - } + # 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 + dict_conn[port["portname"]]["port"] = int(port["portid"]) return dict_conn def get_conn_param(self, args): -- 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 5175283672a985cfd006a06a633dcf4834a09152 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 13:59:59 2015 +0200 The conn modules must now specify which port it usually use. Then on init_conn, a connection is created if a open port of same number exists on the loaded conn mod --- app/module_loader.py | 3 +++ app/modules/connection_modules/ssh.py | 4 ++++ app/modules/storage_modules/shelve_db.py | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/module_loader.py b/app/module_loader.py index 0e89ef1..7347484 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -315,6 +315,7 @@ class ModuleLoader: infos_mod['imported'] = loaded_mod infos_mod['class_name'] = getattr(mod_inst, 'get_name')() infos_mod['params'] = getattr(mod_inst, 'get_parameters')() + infos_mod['known_port'] = getattr(mod_inst, 'get_known_port')() self.loaded_mod_conn[mod_name] = infos_mod except AttributeError: print "Error : internal connection module " + mod_name + " could not have been loaded. " @@ -346,12 +347,14 @@ class ModuleLoader: mod_name: { 'params': {param1: type1, param2: type2, ...} => the parameters necessary to create the connection + 'known_port': int => the usual port used for this connection } } """ res = {} for mod in self.loaded_mod_conn: res[mod] = self.loaded_mod_conn[mod]['params'] + res[mod]['known_port'] = self.loaded_mod_conn[mod]['known_port'] return res def load_all_notification_modules(self): diff --git a/app/modules/connection_modules/ssh.py b/app/modules/connection_modules/ssh.py index f58dfcc..37ba540 100644 --- a/app/modules/connection_modules/ssh.py +++ b/app/modules/connection_modules/ssh.py @@ -10,6 +10,7 @@ class SSH: self.parameters = {"username": "string", "password": "string", "private_key": "file", "port": "int"} self.name = get_class_name() self.addr_host = addr_host + self.known_port = 22 self.CommandNotFoundException = cnfe if params is not None: key_path = str(key_loc) + str(params['private_key']) @@ -34,6 +35,9 @@ class SSH: def get_parameters(self): return self.parameters + def get_known_port(self): + return self.known_port + def exec_command(self, cmd): stdin, stdout, stderr = self.ssh.exec_command(cmd) out = stdout.read() diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 01f1f78..122dca3 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -189,11 +189,12 @@ class shelve_db: def init_conn(dict_nmap_res, conn_infos): """ Returns an initialization for the connection configuration on a host. - :param dict_nmap_res: The result of the nmap detection in dictionnary form + :param dict_nmap_res: The result of the nmap detection in a dictionnary: :param conn_infos: A dictionnary containing informations about connection modules in the form : { mod_name: { 'params': {param1: type1, param2: type2, ...} + 'known_port': int } } :return: a dictionary containing: @@ -208,6 +209,16 @@ class shelve_db: 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: + if conn_infos[loaded_conn_mod]['known_port'] == int(port['portid']): + print "noob" + dict_conn[loaded_conn_mod] = {} + for param in conn_infos[loaded_conn_mod]['params']: + dict_conn[loaded_conn_mod][param] = None + dict_conn[loaded_conn_mod]["priority"] = 0 + dict_conn[loaded_conn_mod]["port"] = conn_infos[loaded_conn_mod]['known_port'] + print dict_conn return dict_conn def get_conn_param(self, args): -- 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 dca7d4d9899a638ad0ca6ab43636af1f6fa622c3 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 9 18:36:39 2015 +0200 hostpage: removed useless function --- README | 2 +- static/js/controllers/hostPageCtrl.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/README b/README index 23e3eca..757eed3 100644 --- a/README +++ b/README @@ -52,4 +52,4 @@ edit local configuration file remove database -Launch the server again: ./run.sh \ No newline at end of file +Launch the server again: ./run.sh location_of_local_conf_file \ No newline at end of file diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index aaba766..d8f8737 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -79,10 +79,6 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $rootScope.$broadcast("sendViaWs", JSON.stringify({"CHECK_NOW": args})); }; - $scope.watch('model.custom_infos', function(){ - console.log($scope.model.custom_infos); - }) - $scope.get_addr_host = function(){ return($scope.addr_host); }; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm