-
Notifications
You must be signed in to change notification settings - Fork 14
/
tc_malwareName.py
56 lines (41 loc) · 1.18 KB
/
tc_malwareName.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
#############################################
# ThreatCrowd API v1.0 Domain Lookup
#
# Author: @chrisdoman
# Email: [email protected]
# Date: 2015-07-26
#############################################
import json
import urllib2
import sys
from MaltegoTransform import *
def main():
malwareName = sys.argv[1]
url = "https://www.threatcrowd.org/searchApi/v1/api.php?type=antivirus&query=" + malwareName
proxy = urllib2.ProxyHandler()
opener = urllib2.build_opener(proxy)
response = opener.open(url)
html = response.read()
for line in html.split('\r'):
if "," in line:
l = line.strip()
type = l.split(',')[0]
value = l.split(',')[1]
reference = l.split(',')[2]
if type == "DOMAIN":
m.addEntity("maltego.Domain", value)
if type == "IP":
m.addEntity("maltego.IPv4Address", value)
if type == "MD5":
m.addEntity("malformity.Hash", value)
if type == "EMAIL":
m.addEntity("maltego.EmailAddress", value)
return
if __name__ == '__main__':
m = MaltegoTransform()
m.addUIMessage("[INFO] Enriching malware name via ThreatCrowd")
try:
main()
except Exception as e:
m.addUIMessage("[Error] " + str(e))
m.returnOutput()