\d{4}\.\d{2}|\d+\.\d+\.\d+|\d+\.\d+)"
+ )
+ try:
+ affected_soft_html = soup.select("[id^=h-affected]")[0]
+ for sibling in affected_soft_html.find_next_siblings():#to get the next html elements
+ if sibling.name == 'h3': # Stop when another is found
+ break
+ if sibling.name == 'p': # Collect
tags
+ #sibling.text
+ matches = pattern.findall(sibling.text)
+ affected_packages = [{"package": match[0].strip(), "version": match[1]} for match in matches]
+ for item in affected_packages:
+ output['affected_packages'].append(item)
+ #output['affected_software'].append(sibling.text.strip())
+ except:
+ pass
+
+
+ #for timeline
+ timeline_td = soup.find_all('td')
+ for i in range(len(timeline_td)):
+ #odd for date,even for summary
+ if i%2==0:
+ output["timeline_dates"].append(timeline_td[i].text)
+ else:
+ output["timeline_summaries"].append(timeline_td[i].text)
+
+ #for summary
+ summary_html = soup.select("[id^=h-security-advisory]")[1]
+ summary_pattern = r"Security Advisory(?:\sYSA-\d{4}-\d{2})?\s*[-–]?\s*"
+ cleaned_summary = re.sub(summary_pattern, "", summary_html.text).strip()
+ output['summary'] = cleaned_summary
+
+ #for published date
+ all_paras = soup.find_all('p')
+ try:
+ for para in all_paras:
+ if 'Published' in para.text:
+ date_match = re.search(r'Published Date:\s*(\d{4}-\d{2}-\d{2})', para.text)
+ published_date = date_match.group(1)
+ output['published_date'] = published_date
+ except:
+ pass
+
+ #for links cve and score
+ for a_tag in soup.find_all('a'):
+ link = a_tag.get("href")
+ if 'cve' in link:
+ #print(link)
+ output["cve"] = a_tag.text
+ if 'cvss' in link:
+ #print(link)
+ output["score"]=a_tag.text
+ return output
\ No newline at end of file
diff --git a/vulnerabilities/templates/index.html b/vulnerabilities/templates/index.html
index cdc9212ed..0ffc38e89 100644
--- a/vulnerabilities/templates/index.html
+++ b/vulnerabilities/templates/index.html
@@ -8,14 +8,14 @@
{% block content %}
-
+
- {% include "vulnerability_search_box.html" %}
+ {% include "package_search_box.html" %}
-
+
- {% include "package_search_box.html" %}
+ {% include "vulnerability_search_box.html" %}