forked from OWASP/owasp-masvs
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgenerate-csv.py
executable file
·44 lines (30 loc) · 1.02 KB
/
generate-csv.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
#!/usr/bin/python
""" Quick and Dirty Roberto Martelloni's script to generate a CSV """
import os
def fromFilenameToArea(filename):
splittedFilename = filename.split("-")
id = splittedFilename[1]
name = splittedFilename[2].split(".")
name = name[0].replace("_", " ")
return id, name
def parsemd(filename):
for line in open(filename):
if line.startswith("|"):
if line.find("| --- |") == 0: continue
if line.find("| # |") == 0: continue
if line.find("| #") == 0: continue
start = fromFilenameToArea(filename)
line = line.replace("*", "")
line = line.split("|")
print start[0] + "|",
print start[1] + "|",
print line[1] + "|",
print line[2] + "|",
print line[3] + "|",
print line[4] + "|"
def main():
for file in os.listdir("./Document"):
if file.find("-V") != -1:
parsemd("./Document/" + file)
if __name__ == '__main__':
main()