-
Notifications
You must be signed in to change notification settings - Fork 2
/
mcafee.py
73 lines (57 loc) · 2.44 KB
/
mcafee.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
72
73
# -*- coding: utf-8 -*-
from MaltegoTransform import *
import requests
import re
baseurl = "https://www.mcafee.com/enterprise/en-us/"
# domain_risk
def domain_risk():
try:
response = requests.get(baseurl + 'threat-intelligence.domaintc.html?vid=' + data)
response = response.text
response = response.encode('utf_8')
if 'ctl00' in response:
match = re.findall(r"<img id=\"[0-9a-zA-Z_]+\" title=\"([A-Za-z _]+)\" class=\"[a-zA-Z ]+\" src=\"[a-z-/\.]+\" .+>",response,re.M)
risk = ','.join(match)
me = mt.addEntity("maltego.Phrase", '%s' % risk + ' Risk')
me.setLinkLabel("McAfee")
if 'Web Category:' in response:
match = re.findall(r"Web Category:\r\n[ ]+(.+)\r\n",response,re.M)
category = ','.join(match)
me = mt.addEntity("maltego.Phrase", '%s' % category)
me.setLinkLabel("McAfee")
except:
pass
return mt
# ip_risk
def ip_risk():
try:
response = requests.get(baseurl + 'threat-intelligence.iptc.html?vid=' + data)
response = response.text
response = response.encode('utf_8')
if 'ctl00_breadcrumbContent_imgRisk\" src=\"/enterprise/' in response:
match = re.findall(r"<img id=\"ctl00_breadcrumbContent_imgRisk\" src=\"[a-z-/]+/([a-zA-Z]+)\.png\"",response,re.M)
risk = ','.join(match)
me = mt.addEntity("maltego.Phrase", '%s' % 'Web:' + risk + ' Risk')
me.setLinkLabel("McAfee")
if 'ctl00_breadcrumbContent_imgRisk1\" src=\"/enterprise/' in response:
match = re.findall(r"<img id=\"ctl00_breadcrumbContent_imgRisk1\" src=\"[a-z-/]+/([a-zA-Z]+)\.png\"",response,re.M)
risk = ','.join(match)
me = mt.addEntity("maltego.Phrase", '%s' % 'Email:' + risk + ' Risk')
me.setLinkLabel("McAfee")
if 'ctl00_breadcrumbContent_imgRisk2\" src=\"/enterprise/' in response:
match = re.findall(r"<img id=\"ctl00_breadcrumbContent_imgRisk2\" src=\"[a-z-/]+/([a-zA-Z]+)\.png\"",response,re.M)
risk = ','.join(match)
me = mt.addEntity("maltego.Phrase", '%s' % 'Network:' + risk + ' Risk')
me.setLinkLabel("McAfee")
except:
pass
return mt
#
#
#
# main
func = sys.argv[1]
data = sys.argv[2]
mt = MaltegoTransform()
mresult = eval(func)()
mresult.returnOutput()