-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathvmprocess.py
79 lines (64 loc) · 2.06 KB
/
vmprocess.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
74
75
76
77
78
79
import re
pattern='''<serverIp>([^<>]*)</serverIp><serverPort>(\d+)</serverPort><hostIp>([^<>]*)</hostIp><hostPort>(\d+)</hostPort>'''
xml=open('vpxascanlog.txt').read()
ms=re.findall(pattern,xml)
#pairs=set(['"%s" -> "%s";' % (j[0],j[2]) for j in ms])
#rs='digraph demo{\n'+'\n'.join(sorted(pairs))+'\n}'
vms = dict()
logs=open('slp_vmware.all.txt').read().split('\n\n')
for log in logs:
if log.find('product')<0:
continue
fs=re.findall('testing ([^\t]+).*?product="([^"]+)"', log.replace('\n','\t'))
if fs and fs[0]:
vms[fs[0][0]] = fs[0][1][len('VMware '):fs[0][1].find(' build')]
vmware = set()
for ln in open('vmware_banner.txt'):
fs = ln.split('\t')
if fs:
vmware.add(fs[0])
vuls = dict()
for ln in open('ssltest2.log'):
fs = ln.strip().split(' ')
if fs and len(fs)==2 and fs[1]=='Y' and fs[0] in vmware:
vuls[fs[0]] = 'SSL'
for ln in open('xxe_vm.txt'):
fs = ln.strip().split(' - - ')
if fs and len(fs)==2:
if fs[0] in vuls:
vuls[fs[0]] += '|XXE'
else:
vuls[fs[0]] = 'XXE'
for ln in open('rmivul.txt'):
fs = ln.strip().split(' - - ')
if fs and len(fs)==2:
if fs[0] in vuls:
vuls[fs[0]] += '|RMI'
else:
vuls[fs[0]] = 'RMI'
allip = set(vms.keys()+vuls.keys()+[j[0] for j in ms]+[j[2] for j in ms])
ostr = 'digraph demo{\nnode [color=Green,fontcolor=Blue,font=Courier]\n'
lines = ''
for j in allip:
label = j
alert = ''
if j in vms:
label += '\\nver:'+vms[j]
if j in vuls:
label += '\\nvul:'+vuls[j]
alert = 'style=filled fillcolor=red '
lines += '"%s" [ label="%s" %s];\n' % (j,label,alert)
ostr += lines
lines = ''
dups = set()
for j in ms:
if j[0]+j[2] not in dups:
lines += '"%s" -> "%s";\n' % (j[0],j[2])
dups.add(j[0]+j[2])
ostr += lines
lines = ''
for j in allip-set([j[0] for j in ms]+[j[2] for j in ms]):
lines += '"%s";\n' % (j)
ostr += lines
ostr += '}\n'
print ostr