/
aggregator.py
57 lines (43 loc) 路 1.4 KB
/
aggregator.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
# aggregator.py
import json
import os
def main():
folders = [file for file in os.listdir(os.getcwd()) if os.path.isdir(file)]
folders.remove('.git')
results = {
'projects': {
'santa-tracker': [],
'plaid': [],
'uamp': [],
'iosched': [],
'sunflower': [],
'duckduckgo': [],
'signal': [],
'corona-warn-app': [],
'immuni-app': [],
'freeotp': [],
'haven': [],
'mozilla-lockwise': [],
'wireguard': []
},
'cves': []
}
for project in folders:
target = f"./{project}/gradle-bodyguard-report.json"
if os.path.exists(target):
with open(target) as reader:
report = json.load(reader)
for issue in report['issues']:
collected = results['projects'][project]
cve = issue['cve']
if cve not in collected:
collected.append(cve)
if cve not in results['cves']:
results['cves'].append(cve)
reader.close()
results['cves'] = sorted(results['cves'])
with open('aggregated-results.json', 'w') as writer:
writer.write(json.dumps(results, indent=2, sort_keys=True))
writer.close()
if __name__ == '__main__':
main()