-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (24 loc) · 1.15 KB
/
main.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
from json import loads
from worksheet_generator import WorkSheetGenerator
from overview_worksheet import OverviewWorksheet
from xlsxwriter import Workbook
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input-json', help='JSON input file with the ASVS controls', required=True)
parser.add_argument('-o', '--output', help='Output filename')
args = parser.parse_args()
def readCSV(filename):
f = open(filename, "r")
data = loads(f.read())
f.close()
return data
if __name__ == "__main__":
data = readCSV(args.input_json)
if not args.output:
args.output = f'ASVS-Checklist-v{data["Version"]}'
workbook = Workbook(f'{args.output}.xlsx')
OverviewWorksheet(workbook=workbook,worksheet_title="Overview", categories=[(x['Name'], x['ShortName']) for x in data['Requirements']])
for category in data['Requirements']:
worksheet = WorkSheetGenerator(workbook=workbook,worksheet_title=data['Name'], worksheet_name=category["Name"], worksheet_shortname=category["ShortName"], name=data["ShortName"], version=data["Version"])
worksheet.generateWorksheet(category['Items'])
workbook.close()