Skip to content

Commit c2a48f6

Browse files
authored
Update update-readme.py
Signed-off-by: AmirHossein Raeisi <[email protected]>
1 parent daa010b commit c2a48f6

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/scripts/update-readme.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def update_vulnerable_status(template_status, vuln_dir):
2727
if base_name in template_status:
2828
template_status[base_name] = "✔️" # Update to ✔️ if found
2929

30-
# Function to update README.md with a table (2 columns: Template Name, Vulnerable Page Exists)
30+
# Function to update README.md with a table (4 columns: Template Name, Vulnerable Page, Template Name, Vulnerable Page)
3131
def update_readme(template_status, root_dir):
3232
readme_file = 'README.md'
33-
github_base_url = "https://github.com/OWASP/www-project-asvs-security-evaluation-templates-with-nuclei/blob/dev/templates/"
33+
github_base_url = "https://github.com/OWASP/www-project-asvs-security-evaluation-templates-with-nuclei/blob/dev/"
3434

3535
try:
3636
with open(readme_file, 'r', encoding='utf-8') as file:
@@ -39,15 +39,22 @@ def update_readme(template_status, root_dir):
3939
# Sort templates based on the first two sections of the version number
4040
sorted_templates = sorted(template_status.items(), key=lambda x: tuple(map(int, x[0].split(".")[:2])))
4141

42-
# Create table rows with 2 columns
42+
# Create table rows with 4 columns
4343
table_rows = ""
44-
for file_name, status in sorted_templates:
45-
file_link = '<a href="' + github_base_url + file_name + '.yaml">' + file_name + '</a>'
46-
table_rows += "<tr><td>" + file_link + "</td><td align='center'>" + status + "</td></tr>\n"
44+
for i in range(0, len(sorted_templates), 2):
45+
# Take two templates at a time
46+
row_templates = sorted_templates[i:i + 2]
47+
row_html = ""
48+
for file_name, status in row_templates:
49+
file_path = next(file for file in yaml_files if file_name in file) # Find full file path
50+
file_url = github_base_url + file_path.replace(os.sep, '/') # Convert path to GitHub URL
51+
file_link = f'<a href="{file_url}">{file_name}</a>'
52+
row_html += f"<td>{file_link}</td><td align='center'>{status}</td>"
53+
table_rows += f"<tr>{row_html}</tr>\n"
4754

4855
table_html = f'''<h2 align="center">Available Templates</h2>
4956
<table border="1" cellpadding="5" cellspacing="0" align="center">
50-
<tr><th>Template Name</th><th>Vulnerable Page Exists</th></tr>
57+
<tr><th>Template Name</th><th>Vulnerable Page</th><th>Template Name</th><th>Vulnerable Page</th></tr>
5158
{table_rows}
5259
</table>
5360
</center>

0 commit comments

Comments
 (0)