-
Notifications
You must be signed in to change notification settings - Fork 7
/
nyx_soltra.py
71 lines (63 loc) · 3.54 KB
/
nyx_soltra.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python
import json
import requests
import time
from common_methods import *
from crits import *
import soltra
from qradar import *
from bro import *
from web_proxy import *
from palo_alto import *
from wise import *
if __name__ == "__main__":
# reading the settings - upon successful read, the functionality will be dependent on the sections in the configuration file
settings=read_configs('nyx.conf')
obs_index={'A':{'medium':[],'high':[]},'Address - ipv4-addr':{'medium':[],'high':[]},'md5':{'medium':[],'high':[]},'email':{'medium':[],'high':[]},'userid':{'medium':[],'high':[]}}
intel={} # validating that the sets in the configuration file are in QRadar
if 'qradar' in settings.keys():
validate_qradar(settings['qradar'])
if 'soltra' in settings.keys():
intel['medium']=soltra.poll_feed(settings['soltra'],'medium')
intel['high']=soltra.poll_feed(settings['soltra'],'high')
for csi,ivalues in intel.iteritems():
for ip in ivalues['AddressObjectType']:
# creating crits-like objects
observable={"type":"Address - ipv4-addr","source":[{"name":"Soltra-"+csi}],'ip':ip['value']}
obs_index['Address - ipv4-addr'][csi].append(ip['value'])
if 'bro' in settings.keys():
alert_bro(observable,settings['bro'])
if 'qradar' in settings.keys():
qradar(observable, settings['qradar'],csi+'_reference_sets')
if 'palo_alto' in settings.keys() and csi == 'high':
palo_alto(observable,settings['palo_alto'],'ip_block_list')
if 'moloch' in settings.keys():
alert_wise(observable, settings['moloch'],csi)
for domain in ivalues['DomainNameObjectType']:
observable={"type":"A","source":[{"name":"Soltra-"+csi}],'domain':domain['value']}
obs_index['A'][csi].append(domain['value'])
if 'bro' in settings.keys():
alert_bro(observable,settings['bro'])
if 'qradar' in settings.keys():
qradar(observable, settings['qradar'],csi+'_reference_sets')
if 'palo_alto' in settings.keys() and csi == 'high':
palo_alto(observable,settings['palo_alto'],'url_block_list')
if 'moloch' in settings.keys():
alert_wise(observable, settings['moloch'],csi)
for file_obj in ivalues['FileObjectType']:
for file_prop in file_obj:
if 'simple_hash_value' in file_prop.keys():
# congratulations, it's a Hash!
try:
observable={"type":file_prop['type'],"source":[{"name":"Soltra-"+csi}],str(file_prop['type']).lower():file_prop['simple_hash_value']['value'],'filename':False}
obs_index['md5'][csi].append(file_prop['simple_hash_value']['value'])
if 'bro' in settings.keys():
alert_bro(observable,settings['bro'])
if 'qradar' in settings.keys():
qradar(observable, settings['qradar'],csi+'_reference_sets')
if 'moloch' in settings.keys():
alert_wise(observable, settings['moloch'],csi)
except:
print {"type":file_prop['type'],"source":[{"name":"Soltra-"+csi}],str(file_prop['type']):file_prop['simple_hash_value']['value'],'filename':False}
if 'qradar' in settings.keys():
qradar_sets_cleanup(obs_index,settings['qradar'])