-
Notifications
You must be signed in to change notification settings - Fork 0
/
cvss_parser.py
executable file
·67 lines (57 loc) · 2.18 KB
/
cvss_parser.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
#!/bin/python3
import argparse
CVSS_first_level = {"AV": ("Access Vector", "This vulnerability can be accessed via %s."),
"AC": ("Access Complexity", "The complexity of exploiting this vulnerability is %s."),
"Au": ("Authentication", "This vulnerability %s authentification to be exploited."),
"C": ("Confidentiality Impact", "This vulnerability lead to %s confidentiality impact."),
"I": ("Integrity Impact", "This vulnerability lead to %s integrity impact."),
"A": ("Availability Impact", "This vulnerability lead to %s availability impact.")
}
CVSS_second_level = {"AV":
{
"L":"Local access",
"A":"Adjacent network",
"N":"Network"
},
"AC":
{
"H":"High",
"M":"Medium",
"L":"Low"
},
"Au":
{
"N":"Requires no",
"S":"Requires single instance",
"M":"Requires multiple instances"
},
"C":
{
"N":"No",
"P":"Partial",
"C":"Complete"
},
"I":
{
"N":"No",
"P":"Partial",
"C":"Complete"
},
"A":
{
"N":"None",
"P":"Partial",
"C":"Complete"
}
}
def parse(s):
for e in s.split("/"):
k,v = e.split(":")
print("%s:" % CVSS_first_level[k][0])
print(CVSS_first_level[k][1] % CVSS_second_level[k][v].lower())
print()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('cvss', help='CVSS to parse')
args = parser.parse_args()
parse(args.cvss)