forked from toolswatch/vFeed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vfeed_calls_samples.py
executable file
·174 lines (125 loc) · 5.27 KB
/
vfeed_calls_samples.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env python
from vfeed import vFeed, vFeedInfo, vFeedXML,vFeedUpdate, vFeedSearch
'''
vfeed_calls_sample.py - Sample script to call methods from your programs
Wiki documentation https://github.com/toolswatch/vFeed/wiki
'''
# create an instance of the class vFeedInfo
print '[instance] creating an instance with vFeedApi.vFeedInfo() '
info = vFeedInfo()
print '[invoking] the get_version() method '
print 'version: ', info.get_version()['build']
print '[invoking] the get_owner() method '
print 'author (if you want to get in touch and say hello):', info.get_owner()['author']
print '[invoking] the get_config() method (note that the values are returned in dict. You can then read any key value you need ..'
print 'vFeed global config returned as dict:', info.get_config()['primary']
# Invoking the vFeed class
cve = "cve-2014-0160"
print '[setting] using cve ', cve
# create an instance of the class vFeed and pass the cve
print '[instance] creating an instance with vFeedApi.vFeed(cve) '
vfeed = vFeed(cve)
print '[invoking] the get_cve() method '
# invoking the get_cve method
cveInfo = vfeed.get_cve()
if cveInfo:
# returned data is a dictionary with 3 keys.
print 'description: ', cveInfo['summary']
print 'published date: ', cveInfo['published']
print 'modified date: ', cveInfo['modified']
# invoking the get_cvss method
print '[invoking] the get_cvss() method '
cvssScore = vfeed.get_cvss()
if cvssScore:
print 'base score:', cvssScore['base']
print 'impact score:', cvssScore['impact']
print 'exploit score:', cvssScore['exploit']
print 'AV (access vector):', cvssScore['access_vector']
print 'AC (access complexity):', cvssScore['access_complexity']
print 'Au (authentication):', cvssScore['authentication']
print 'C (confidentiality impact):', cvssScore['confidentiality_impact']
print 'I (integrity impact):', cvssScore['integrity_impact']
print 'A (availability impact):', cvssScore['availability_impact']
# invoking the get_refs method (it's not longer get_refserences)
print '[invoking] the get_refs() method '
cverefs = vfeed.get_refs()
for i in range(0, len(cverefs)):
print 'refs id:', cverefs[i]['id']
print 'refs link', cverefs[i]['link']
print 'total found refs', len(cverefs)
# invoking the get_cwe method
print '[invoking] the get_cwe() method '
cvecwe = vfeed.get_cwe()
for i in range(0, len(cvecwe)):
print 'cwe id:', cvecwe[i]['id']
print 'cwe title:', cvecwe[i]['title']
print 'total found cwe', len(cvecwe)
## invoking the get_capec method
print '[invoking] the get_capec() method '
cvecapec = vfeed.get_capec()
cvecwe = vfeed.get_cwe()
for i in range(len(cvecwe), len(cvecapec) + len(cvecwe)):
print 'capec id %s associated with %s ' %(cvecapec[i]['id'],cvecapec[i]['cwe'])
print 'total found capec', len(cvecapec)
# invoking the get_category method
print '[invoking] the get_category() method '
cvecategory = vfeed.get_category()
cvecwe = vfeed.get_cwe()
for i in range(len(cvecwe), len(cvecategory) + len(cvecwe)):
print '%s is listed in %s --> %s ' %(cve, cvecategory[i]['id'],cvecategory[i]['title'])
print '[invoking] the get_cpe() method '
cvecpe = vfeed.get_cpe()
for i in range(0, len(cvecpe)):
print 'cpe id:', cvecpe[i]['id']
print 'total found cpe', len(cvecpe)
print '[invoking] the get_debian() method '
cveDEB = vfeed.get_debian()
for i in range(0, len(cveDEB)):
print 'debian id:', cveDEB[i]['id']
print 'total found debian', len(cveDEB)
print '[invoking] the get_oval() method '
cveoval = vfeed.get_oval()
for i in range(0, len(cveoval)):
print 'oval id:', cveoval[i]['id']
print 'oval file', cveoval[i]['file']
print 'total found oval', len(cveoval)
print '[invoking] the get_nessus() method '
cvenessus = vfeed.get_nessus()
for i in range(0, len(cvenessus)):
print 'nessus id:', cvenessus[i]['id']
print 'nessus name', cvenessus[i]['name']
print 'nessus file', cvenessus[i]['file']
print 'nessus family', cvenessus[i]['family']
print 'total found nessus', len(cvenessus)
print '[invoking] the get_edb() method '
cveedb = vfeed.get_edb()
for i in range(0, len(cveedb)):
print 'edb id:', cveedb[i]['id']
print 'edb file', cveedb[i]['file']
print 'total found edb', len(cveedb)
print '[invoking] the get_saint() method '
cvesaintexp = vfeed.get_saint()
for i in range(0, len(cvesaintexp)):
print 'saint Exploit id:', cvesaintexp[i]['id']
print 'saint Exploit Title:', cvesaintexp[i]['title']
print 'saint Exploit File:', cvesaintexp[i]['file']
print 'total found saint Exploit', len(cvesaintexp)
print '[invoking] the get_msf() method '
cvemsfexp = vfeed.get_msf()
for i in range(0, len(cvemsfexp)):
print 'msf Exploit id:', cvemsfexp[i]['id']
print '\tmsf Exploit Title:', cvemsfexp[i]['title']
print '\tmsf Exploit File:', cvemsfexp[i]['file']
print 'total found msf Exploit', len(cvemsfexp)
print '[Generating XML] Invoking the exportXML() method '
cve = "cve-2014-0160"
print '[Exporting] Creating new instance with cve ', cve
vfeed = vFeedXML(cve)
vfeed.export()
print '[Updating db] Invoking the update method from within your scripts'
db = vFeedUpdate()
db.update()
print '[searching a CPE] Invoking the search method from within your scripts'
mycpe = "cpe:/a:adobe:acrobat:9.5.1"
search = vFeedSearch(mycpe)
search.search()