diff --git a/docs/generate_cve_list.py b/docs/generate_cve_list.py
new file mode 100644
index 000000000..f06683099
--- /dev/null
+++ b/docs/generate_cve_list.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python3
+import os
+import json
+import re
+
+# Path to enumerate CVEs from
+dir = "../"
+CVE_list = []
+
+# Fetch all the years
+years = os.listdir(dir)
+# Remove non-numeric years
+years = [year for year in years if year.isdigit()]
+# Sort descending (we want the latest at the top)
+years.sort(reverse=True)
+
+# Clean up the text blocks
+def clean_text(description_text):
+ description = re.sub(r'\n+', '\n', description_text)
+ # Remove the '-' at the beginning of each line
+ description_lines = description.split('\n')
+ description_lines = [line.lstrip('- ') for line in description_lines]
+ # Add
for each line
+ description = '\n'.join(description_lines)
+ return description
+
+# Generate JSON for each CVE
+for year in years:
+ yearDir = os.path.join(dir, year)
+ for CVE_filename in os.listdir(yearDir):
+ # Open CVE file
+ with open(os.path.join(yearDir, CVE_filename), 'r') as CVE_file:
+ # Read CVE file
+ CVE_file_content = CVE_file.read()
+
+ # Extract CVE description, references, and GitHub links
+ CVE_description = CVE_file_content.split('### Description')[1].split('###')[0].strip()
+ CVE_references = CVE_file_content.split('### Reference')[1].split('###')[0].strip()
+ CVE_github = CVE_file_content.split('### Github')[1].split('###')[0].strip()
+
+ CVE_Name = CVE_filename.split('.')[0]
+
+ CVE_description = clean_text(CVE_description)
+ CVE_github = clean_text(CVE_github)
+ CVE_references = clean_text(CVE_references)
+
+ CVE_poc = [ref for ref in CVE_references.split('\n') if "No PoCs" not in ref]
+ CVE_poc += [poc for poc in CVE_github.split('\n') if "No PoCs" not in poc]
+
+ thisCVE = {"cve": CVE_Name, "desc": CVE_description, "poc": CVE_poc}
+ CVE_list.append(thisCVE)
+
+# Convert CVE list to JSON without indentation
+CVE_output = json.dumps(CVE_list)
+
+# Save CVE list to JSON file
+with open('CVE_list.json', 'w') as outfile:
+ outfile.write(CVE_output)
+
+print("CVE list saved to CVE_list.json")
diff --git a/docs/generate_summary_json.py b/docs/generate_summary_json.py
deleted file mode 100644
index 87a90ac92..000000000
--- a/docs/generate_summary_json.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python3
-import os
-import datetime
-import sys
-import json
-import re
-
-#Path to enumerate CVEs from
-dir = "../"
-CVE_list = []
-
-#fetch all the years
-years = os.listdir(dir)
-#remove non numeric years
-years = [year for year in years if year.isdigit()]
-#sort descending (we want the latest at the top)
-years.sort(reverse=True)
-
-#clean up the text blocks
-def clean_text(description_text):
- description = re.sub(r'\n+', '\n', description_text)
- #remove the '-' at the beginning of each line
- description_lines = description.split('\n')
- description_lines = [line.lstrip('- ') for line in description_lines]
-
- #change urls with links with regular expression
- #description_lines = [re.sub(r'(https?:\/\/[^\s]+)', r'\1', line) for line in description_lines]
-
- #add
for each line
- description = '\n'.join(description_lines)
- return description
-
-#generate JSON for each CVE
-for year in years:
-
- yearDir = os.path.join(dir, year)
- for CVE_filename in os.listdir(yearDir):
-
- #open CVE file
- CVE_file = open(os.path.join(yearDir, CVE_filename), 'r')
- #read CVE file
- CVE_file_content = CVE_file.read()
-
- #extract CVE description, references and github
- CVE_description = CVE_file_content.split('### Description')[1].split('###')[0].strip()
- CVE_references = CVE_file_content.split('### Reference')[1].split('###')[0].strip()
- CVE_github = CVE_file_content.split('### Github')[1].split('###')[0].strip()
-
- #TODO: extract imageshield label attributes
-
- CVE_Name = CVE_filename.split('.')[0]
-
- CVE_description = clean_text(CVE_description)
- CVE_github = clean_text(CVE_github)
- CVE_references = clean_text(CVE_references)
- CVE_poc = []
- if "No PoCs" not in CVE_references:
- if '\n' in CVE_references:
- for ref in CVE_references.split('\n'):
- CVE_poc.append(ref)
- else:
- CVE_poc.append(CVE_references)
- if "No PoCs" not in CVE_github:
- if '\n' in CVE_github:
- for poc in CVE_github.split('\n'):
- CVE_poc.append(poc)
- else:
- CVE_poc.append(CVE_github)
-
- thisCVE = {"cve": CVE_Name, "desc": CVE_description, "poc": CVE_poc}
- CVE_list.append(thisCVE)
-
-CVE_output = f"{json.dumps(CVE_list)}"
-
-#save CVE list to JSON file
-with open('CVE_list.json', 'w') as outfile:
- outfile.write(CVE_output)
diff --git a/docs/logic.js b/docs/logic.js
index 6adba3e92..0a6d45448 100644
--- a/docs/logic.js
+++ b/docs/logic.js
@@ -10,66 +10,53 @@ const noResults = document.querySelector('div.noResults');
const colorUpdate = document.body;
function escapeHTML(str) {
- return str.replace(/[&<>"']/g, function (match) {
- const escapeChars = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": '''
- };
- return escapeChars[match];
- });
+ return str.replace(/[&<>"']/g, match => ({
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ }[match]));
}
function convertLinksToList(links) {
if (links.length === 0) {
- return content;
+ return '';
}
- let htmlOutput = `