branch develop updated (f3f3cce -> 0a179b4)
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 f3f3cce detection modules loaded with connection multi compatibility new dc557b1 dashboard: multiple select filter for status new 0a179b4 hostapege: change the hostname (function called have been changed for every nmap attributes) + snmp connection module added 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 0a179b45441193164623b26cb50f60e760228717 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 15 14:54:47 2015 +0200 hostapege: change the hostname (function called have been changed for every nmap attributes) + snmp connection module added commit dc557b11dcdc1447ea9ef28ef8fad28075e115a5 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 15 10:38:56 2015 +0200 dashboard: multiple select filter for status Summary of changes: app/modules/connection_modules/snmp.py | 61 ++++++++++++++++++++++++++++++++ app/modules/storage_modules/shelve_db.py | 9 ++--- requirements.txt | 1 + static/js/controllers/dashboardCtrl.js | 8 +++-- static/js/controllers/hostPageCtrl.js | 8 +++-- views/dashboard.html | 12 ++++--- views/hostpage.html | 9 ++++- 7 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 app/modules/connection_modules/snmp.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 dc557b11dcdc1447ea9ef28ef8fad28075e115a5 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 15 10:38:56 2015 +0200 dashboard: multiple select filter for status --- static/js/controllers/dashboardCtrl.js | 8 ++++++-- views/dashboard.html | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/static/js/controllers/dashboardCtrl.js b/static/js/controllers/dashboardCtrl.js index cf5b417..07df506 100644 --- a/static/js/controllers/dashboardCtrl.js +++ b/static/js/controllers/dashboardCtrl.js @@ -40,10 +40,10 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH $scope.name_filter = ''; if($routeParams.param == null){ - $scope.status_filter = ''; + $scope.status_filter = ["success", "warning", "danger"]; } else{ - $scope.status_filter = $routeParams.param; + $scope.status_filter = [$routeParams.param]; } $scope.group_filter = ''; @@ -52,6 +52,10 @@ mumApp.controller('dashboardCtrl', function($scope, $filter, $routeParams, DataH $scope.grp = "all"; + $scope.filtering_status = function(item){ + return($scope.status_filter.lastIndexOf(item.status) >= 0); + } + // Concerning the table manipulation var searchMatch = function (haystack, needle) { return !needle || haystack.toLowerCase().indexOf(needle.toLowerCase()) !== -1; diff --git a/views/dashboard.html b/views/dashboard.html index 79bde16..4e964cb 100644 --- a/views/dashboard.html +++ b/views/dashboard.html @@ -14,8 +14,7 @@ </div> <div class="col-xs-2"> <label for="status_f">Status filter</label> - <select class="form-control input-sm" id="status_f" ng-model="status_filter"> - <option></option> + <select multiple class="form-control input-sm" id="status_f" ng-model="status_filter"> <option>success</option> <option>warning</option> <option>danger</option> @@ -23,7 +22,10 @@ </div> <div class="col-xs-2"> <label for="group_f">Group filter</label> - <select class="form-control input-sm" id="group_f" ng-model="group_filter" ng-options="item for item in allGroups() | unique:'group'"> + <select class="form-control input-sm" + id="group_f" + ng-model="group_filter" + ng-options="item for item in allGroups() | unique:'group'"> </select> </div> <table class="table table-condensed table-hover"> @@ -66,7 +68,9 @@ <tbody> <tr ng-repeat="item in items | orderBy:sort.sortingOrder:sort.reverse | - filter:{addr:addr_filter, name:name_filter, status:status_filter, group:group_filter}" class={{item.status}}> <!-- group.name:group_filter --> + filter:{addr:addr_filter, name:name_filter, group:filtering_group} | + filter:filtering_status" + class={{item.status}}> <!-- group.name:group_filter --> <td><a href="#/hostpage/{{item.addr}}">{{item.addr}}</a></td> <td>{{item.name}}</td> <td>warning : {{item.warning}}<br/> -- 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 0a179b45441193164623b26cb50f60e760228717 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 15 14:54:47 2015 +0200 hostapege: change the hostname (function called have been changed for every nmap attributes) + snmp connection module added --- app/modules/connection_modules/snmp.py | 61 ++++++++++++++++++++++++++++++++ app/modules/storage_modules/shelve_db.py | 9 ++--- requirements.txt | 1 + static/js/controllers/hostPageCtrl.js | 8 +++-- views/hostpage.html | 9 ++++- 5 files changed, 80 insertions(+), 8 deletions(-) diff --git a/app/modules/connection_modules/snmp.py b/app/modules/connection_modules/snmp.py new file mode 100644 index 0000000..2541f62 --- /dev/null +++ b/app/modules/connection_modules/snmp.py @@ -0,0 +1,61 @@ +__author__ = 'aguilbaud' + +from pysnmp.entity.rfc3413.oneliner import cmdgen + +def get_class_name(): + return "SNMP" + + +class SNMP: + def __init__(self, addr_host, params, key_loc, cnfe): + self.parameters = {"port": "int"} + self.name = get_class_name() + self.addr_host = addr_host + self.known_port = 161 + self.CommandNotFoundException = cnfe + self.cmdGen = cmdgen.CommandGenerator() + + def get_name(self): + return self.name + + def get_addr_host(self): + # Called by monitoring modules + return self.addr_host + + def get_parameters(self): + return self.parameters + + def get_known_port(self): + return self.known_port + + def exec_command(self, cmd): + res = "" + errorIndication, errorStatus, errorIndex, varBinds = self.cmdGen.getCmd( + cmdgen.CommunityData('public'), + cmdgen.UdpTransportTarget((self.addr_host, self.parameters['port'])), + cmd + ) + + # Check for errors and print out results + if errorIndication: + print(errorIndication) + else: + if errorStatus: + print('%s at %s' % ( + errorStatus.prettyPrint(), + errorIndex and varBinds[int(errorIndex)-1] or '?' + ) + ) + else: + for name, val in varBinds: + if val == "": + exception_inst = getattr(self.CommandNotFoundException, "CommandNotFoundException")( + cmd, self.addr_host + ) + raise exception_inst + else: + res = val + return res + + def disconnect(self): + self.cmdGen = None \ 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 4afe0f7..b1cfa7f 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -455,20 +455,21 @@ class shelve_db: finally: self.close_db() - def update_os_name(self, args): + def update_nmap_attribute(self, args): """ Called from the hostpage. - Updatdes the operating system detected with nmap for a given host. The os name is saved in lower case. + Updatdes an attribute detected by nmap for a given host. :param args: a dictionary containing : { + 'attribute': string, 'addr_host': string, - 'new_os_name': string + 'new_value': 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() + nmap_detection[args['attribute']] = args['new_value'].lower() self.db['hosts'][args['addr_host']]['detected']['nmap'] = json.dumps(nmap_detection) except Exception: print traceback.format_exc() diff --git a/requirements.txt b/requirements.txt index 3cef053..fb039e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ bottle==0.12.7 +pysnmp pexpect paramiko bottle-websocket diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 6dcf145..2717d01 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -44,11 +44,12 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar } } */ - $scope.update_os_name = function(){ + $scope.update_nmap_attribute = function(attribute, new_value){ var args = {}; + args['attribute'] = attribute; 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}})); + args['new_value'] = new_value; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_nmap_attribute', 'args': args}})); }; $scope.get_unit = function(mod_name){ @@ -70,6 +71,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $scope.model = {custom_infos : '', new_os : '', + new_hostname : '', compatible_os_list: []}; $scope.check = function(modname){ diff --git a/views/hostpage.html b/views/hostpage.html index 8bda3e6..269e193 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -49,9 +49,16 @@ ng-options="os for os in model.compatible_os_list"> </select> <button type="button" class="btn btn-info btn-xs" - ng-click="update_os_name()" + ng-click="update_nmap_attribute('os', model.new_os)" ng-disabled="model.new_os==''">Correct OS name</button> </td> + <td ng-show="(key == 'hostname')"> + <input type="text" + ng-model="model.new_hostname"/> + <button type="button" class="btn btn-info btn-xs" + ng-click="update_nmap_attribute('hostname', model.new_hostname)" + ng-disabled="model.new_hostname==''">Correct hostname</button> + </td> </tr> </table> </accordion-group> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm