branch develop updated (30f20df -> 0a32ad4)
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 30f20df envoi de notification par e-mail fonctionnel (sans prendre en compte le nombre d'ittérations) new bcd76ec correction de notif pour groupes new 0a32ad4 hostpage: correction du nom de l'OS possible The 2 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 0a32ad4ca731c7046a6a8ab8f36258bb0c35f735 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Mar 24 15:13:05 2015 +0100 hostpage: correction du nom de l'OS possible commit bcd76ecfa202045da3466b7682a590dcdd610096 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Mar 24 11:51:37 2015 +0100 correction de notif pour groupes Summary of changes: app/app.py | 2 +- app/modules/storage_modules/shelve_db.py | 39 +++++++++++++++++++++++++------- static/js/controllers/hostPageCtrl.js | 9 +++++++- views/hostpage.html | 7 ++++-- 4 files changed, 45 insertions(+), 12 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 bcd76ecfa202045da3466b7682a590dcdd610096 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Mar 24 11:51:37 2015 +0100 correction de notif pour groupes --- app/modules/storage_modules/shelve_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 685f7c0..59ef06c 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -775,7 +775,7 @@ class shelve_db: 'msg': msg}) for group in self.db['groups']: # creates a message for all subscribers in a group which the host is member - if addr_host in self.db['groups'][group]: + if addr_host in self.db['groups'][group]['hosts']: for username in self.db['groups'][group]['subscribers']: for notif_mod in self.db['groups'][group]['subscribers'][username][notif_type]: param_notif = self.db['groups'][group]['subscribers'][username][notif_type][notif_mod] -- 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 0a32ad4ca731c7046a6a8ab8f36258bb0c35f735 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue Mar 24 15:13:05 2015 +0100 hostpage: correction du nom de l'OS possible --- app/app.py | 2 +- app/modules/storage_modules/shelve_db.py | 37 ++++++++++++++++++++++++++------ static/js/controllers/hostPageCtrl.js | 9 +++++++- views/hostpage.html | 7 ++++-- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/app/app.py b/app/app.py index be74737..c7b9743 100755 --- a/app/app.py +++ b/app/app.py @@ -185,7 +185,7 @@ if __name__ == '__main__': wsc = WebSocketContainer(ml.get_db()) #dict_notif = ml.db.add_check('127.0.0.1', "ping", False) #ml.run_notification_modules(dict_notif) - 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) # after ending diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 59ef06c..749c831 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -252,13 +252,13 @@ class shelve_db: try: for mod in self.db['hosts'][addr_host]['conf']['monitoring']: if self.db['hosts'][addr_host]['conf']['monitoring'][mod]['activated']: - dict = {} - dict['addr'] = addr_host - dict['os'] = json.loads(self.db['hosts'][addr_host]['detected']['nmap'])['os'] - dict['mod_name'] = mod - dict['time'] = datetime.now() - dict['freq'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod]['check_frequency'] - res.append(dict) + dict_moni = {} + dict_moni['addr'] = addr_host + dict_moni['os'] = json.loads(self.db['hosts'][addr_host]['detected']['nmap'])['os'] + dict_moni['mod_name'] = mod + dict_moni['time'] = datetime.now() + dict_moni['freq'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod]['check_frequency'] + res.append(dict_moni) except Exception as e: print e.__str__() finally: @@ -438,6 +438,25 @@ class shelve_db: finally: self.close_db() + def update_os_name(self, args): + """ + Updatdes the operating system detected with nmap for a given host. The os name is saved in lower case. + :param args: a dictionary containing : + { + 'addr_host': string, + 'new_os_name': string + } + """ + self.open_db() + try: + nmap_detection = json.loads(self.db['hosts'][args['addr_host']]['detected']['nmap']) + nmap_detection['os'] = args['new_os_name'].lower() + self.db['hosts'][args['addr_host']]['detected']['nmap'] = json.dumps(nmap_detection) + except Exception as e: + print e.__str__() + finally: + self.close_db() + def update_custom_informations(self, args): """ Updates the custom informations stored on the host's configuration @@ -774,12 +793,16 @@ class shelve_db: 'title': "[Mum] " + status + " on " + addr_host, 'msg': msg}) for group in self.db['groups']: + # creates a message for all subscribers in a group which the host is member if addr_host in self.db['groups'][group]['hosts']: for username in self.db['groups'][group]['subscribers']: for notif_mod in self.db['groups'][group]['subscribers'][username][notif_type]: param_notif = self.db['groups'][group]['subscribers'][username][notif_type][notif_mod] if param_notif['activated']: + title = "[Mum] " + status + " for " + addr_host + " on group " + group + msg = "Mum repported a " + status + " from the " + moni_mod + " module on host " + \ + addr_host + " member of group " + group if notif_mod not in dict_notif: dict_notif[notif_mod] = [] dict_notif[notif_mod].append({'user': self.db['users'][username]['settings'], diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 0900387..0835013 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -34,7 +34,14 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $routeParams, $mo "custom_infos":val } */ - $scope.model = {custom_infos : ''}; + $scope.update_os_name = function(){ + args = {}; + args['addr_host'] = $scope.addr_host; + args['new_os_name'] = $scope.model.new_os; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_os_name', 'args': args}})); + } + + $scope.model = {custom_infos : '', new_os : ''}; $scope.check = function(modname){ var args = {}; diff --git a/views/hostpage.html b/views/hostpage.html index 9b97661..689a4b6 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -37,8 +37,11 @@ ng-repeat="(key, val) in mod"> <td>{{key}}</td> <td>{{val}}</td> - <td ng-show="(key == 'os') && (val == 'unknown')"> - <button type="button" class="btn btn-info btn-xs">Please indicate the OS</button> + <td ng-show="(key == 'os')"> + <input type="text" ng-model="model.new_os"> + <button type="button" class="btn btn-info btn-xs" + ng-click="update_os_name()" + ng-disabled="model.new_os==''">Correct OS name</button> </td> </tr> </table> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm