-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathotx_email.py
executable file
·45 lines (38 loc) · 1.04 KB
/
otx_email.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
#############################################
# OTX Maltego Plugin
#
# Email: [email protected]
#############################################
import json
import requests
import sys
from MaltegoTransform import *
import traceback
from OTXv2 import OTXv2
import IndicatorTypes
import re
from OTXSettings import OTXSetting
def getDomains(email):
domains = []
# Note https://otx.alienvault.com/api/v1/indicator/email/ isnt available
result = requests.get('https://otx.alienvault.com/otxapi/indicator/email/whois/' + email).content
j = json.loads(result)
for dom in j:
domains.append( dom['domain'] )
return domains
def main():
# Todo - Used?
otx_settings = OTXSetting()
otx = OTXv2(otx_settings.API_KEY)
email = sys.argv[1]
for domain in getDomains(email):
m.addEntity("maltego.Domain", domain)
return
if __name__ == '__main__':
m = MaltegoTransform()
m.addUIMessage("[INFO] Enriching domain via OTX")
try:
main()
except Exception as e:
m.addUIMessage("[Error] " + str(e) + '\n' + traceback.format_exc())
m.returnOutput()