-
Notifications
You must be signed in to change notification settings - Fork 404
Expand file tree
/
Copy pathqintel_qwatch.py
More file actions
executable file
·68 lines (50 loc) · 1.8 KB
/
Copy pathqintel_qwatch.py
File metadata and controls
executable file
·68 lines (50 loc) · 1.8 KB
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
#!/usr/bin/env python3
# encoding: utf-8
from cortexutils.analyzer import Analyzer
from qintel_helper import search_qwatch
class QWatch(Analyzer):
VERSION = '1.0'
def __init__(self):
Analyzer.__init__(self)
self.client_id = self.get_param('config.access_id', None,
'Missing Crosslink ID')
self.client_secret = self.get_param('config.access_secret', None,
'Missing Crosslink Secret')
self.remote = self.get_param('config.remote', None)
def _search(self, data):
kwargs = {
'remote': self.remote,
'client_id': self.client_id,
'client_secret': self.client_secret,
'user_agent': f'cortex/{self.VERSION}',
'params': {
'meta[total]': True,
'stats': True
}
}
try:
return search_qwatch(data, self.data_type, 'exposures', **kwargs)
except RuntimeWarning:
pass
except Exception as e:
self.error(f'Qintel API: request failed, {str(e)}')
def summary(self, raw):
taxonomies = []
ns = 'Qintel'
level = 'info'
count = self.res['meta']['total']
taxonomies.append(self.build_taxonomy(level, ns,
'CredentialCount', count))
return {'taxonomies': taxonomies}
def run(self):
if self.data_type not in ['domain', 'mail']:
self.error('Unsupported data type')
if self.data_type == 'mail':
self.data_type = 'email'
data = self.getData()
self.res = self._search(data)
self.report({
'Qintel_QWatch': self.res
})
if __name__ == '__main__':
QWatch().run()