зеркало из https://github.com/mozilla/MozDef.git
Fix mozillaLocation mq plugin
This commit is contained in:
Родитель
2b389b3e19
Коммит
c632ed8250
|
@ -9,7 +9,7 @@
|
||||||
# Brandon Myers bmyers@mozilla.com
|
# Brandon Myers bmyers@mozilla.com
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from configlib import getConfig, OptionParser
|
from configlib import getConfig
|
||||||
|
|
||||||
|
|
||||||
class message(object):
|
class message(object):
|
||||||
|
@ -24,10 +24,8 @@ class message(object):
|
||||||
self.priority = 5
|
self.priority = 5
|
||||||
|
|
||||||
config_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), "mozillaLocation.conf")
|
config_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), "mozillaLocation.conf")
|
||||||
parser = OptionParser()
|
self.dc_code_list = getConfig('dc_code_list', '', config_location).split(',')
|
||||||
(self.options, args) = parser.parse_args()
|
self.offices_code_list = getConfig('offices_code_list', '', config_location).split(',')
|
||||||
self.options.dc_code_list = getConfig('dc_code_list', '', config_location).split(',')
|
|
||||||
self.options.offices_code_list = getConfig('offices_code_list', '', config_location).split(',')
|
|
||||||
|
|
||||||
def onMessage(self, message, metadata):
|
def onMessage(self, message, metadata):
|
||||||
if 'details' in message.keys() and 'hostname' in message['details'].keys():
|
if 'details' in message.keys() and 'hostname' in message['details'].keys():
|
||||||
|
@ -35,9 +33,9 @@ class message(object):
|
||||||
if len(hostnamesplit) == 5:
|
if len(hostnamesplit) == 5:
|
||||||
if 'mozilla' == hostnamesplit[-2]:
|
if 'mozilla' == hostnamesplit[-2]:
|
||||||
message['details']['site'] = hostnamesplit[-3]
|
message['details']['site'] = hostnamesplit[-3]
|
||||||
if message['details']['site'] in self.options.dc_code_list:
|
if message['details']['site'] in self.dc_code_list:
|
||||||
message['details']['sitetype'] = 'datacenter'
|
message['details']['sitetype'] = 'datacenter'
|
||||||
elif message['details']['site'] in self.options.offices_code_list:
|
elif message['details']['site'] in self.offices_code_list:
|
||||||
message['details']['sitetype'] = 'office'
|
message['details']['sitetype'] = 'office'
|
||||||
else:
|
else:
|
||||||
message['details']['sitetype'] = 'unknown'
|
message['details']['sitetype'] = 'unknown'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче