-
Notifications
You must be signed in to change notification settings - Fork 1
/
report.py
55 lines (49 loc) · 1.4 KB
/
report.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
import datetime
from dataclasses import asdict, dataclass
@dataclass
class Vulnerability:
check_name: str
description: str
recommendation: str
proof: str
severity: str
app_key: str
app_name: str
date: str
class Reporter:
def __init__(self, app_key, app_name):
self.started_at = datetime.datetime.now(datetime.timezone.utc).isoformat()
self.vulns = []
self.app_key = app_key
self.app_name = app_name
def add_vuln(
self,
check_name: str,
description: str,
recommendation: str,
proof: str,
severity: str,
):
self.vulns.append(
asdict(
Vulnerability(
check_name=check_name,
description=description,
recommendation=recommendation,
proof=proof,
severity=severity,
app_key=self.app_key,
app_name=self.app_name,
date=str(datetime.date.today()),
)
)
)
def finish(self):
return {
"vulns": self.vulns,
"scanner": "Connect Vulnerability Scanner",
"started_at": self.started_at,
"ended_at": datetime.datetime.now(datetime.timezone.utc).isoformat(),
"scanned": [self.app_key],
"errors": False,
}