-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
49 lines (40 loc) · 1.5 KB
/
run.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
import argparse
from intel import intel
from esconnect import es
from elasticsearch_dsl import Search
import configparser
import os.path
#Run as windows service - schedule task - cronjob
#Compare query to intel index
#If already exist in intel index ignore
#If not in index, query VT and write to index
#If score is higher than X than send email(s)
config = configparser.ConfigParser()
if os.path.isfile('enricher_custom.conf'):
config.read('enricher_custom.conf')
else:
config.read('enricher.conf')
apikey = config['DEFAULT']['apikey']
desc = 'Intel Checker'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument("--data", "-d", help="Example: google.com or F68E37DC9CABF2EE8B94D6A5D28AD04BE246CCC2E82911F8F1AC390DCF0EE364")
args = parser.parse_args()
if args.data:
data = intel(args.data, apikey)
if data.matchregex:
print("{0} matches the regex for {1}".format(data.data, data.datatype))
data.check()
if data.hasdata == True:
data.parse()
print("The query \"{0}\" has a total of {1} hits from {2} intel sources.".format(data.data, data.score, data.totalsources))
else:
print("Data does not exist or the rate limit has been met")
else:
print("Query provided does not match an accepted value")
exit()
#ES Tester
#client = es()
#client.connect()
#client.search = Search(using=client.client, index='*:logstash-bro*').query({"match" : {"event_type":"bro_dns"}}).filter('range', ** { '@timestamp': {'gt': 'now-15m'}})
#client.query()
#print(client.list)