|
6 | 6 | from pyExploitDb import PyExploitDb
|
7 | 7 | from bs4 import BeautifulSoup
|
8 | 8 |
|
9 |
| -art = """ |
| 9 | +art = r""" |
10 | 10 | _______ _ _ _______
|
11 | 11 | |__ __| | | |__ __|
|
12 | 12 | | | | |__ _ __ ___ __ _| |_ | |_ __ __ _ ___ ___ _ __
|
@@ -67,8 +67,12 @@ def fetch_cve_details(cpe_string):
|
67 | 67 | pEdb = PyExploitDb()
|
68 | 68 | pEdb.debug = False
|
69 | 69 | pEdb.openFile()
|
70 |
| - exploit_status = "Public Exploit Found over Exploit-DB" if pEdb.searchCve(cve_id) else "No Public Exploit Found over Exploit-DB" |
71 |
| - |
| 70 | + |
| 71 | + try: |
| 72 | + exploit_status = "Public Exploit Found over Exploit-DB" if pEdb.searchCve(cve_id) else "No Public Exploit Found over Exploit-DB" |
| 73 | + except ValueError as e: |
| 74 | + exploit_status = "Error processing Exploit-DB response." |
| 75 | + |
72 | 76 | snyk_short_name = synk_db(cve_id)
|
73 | 77 |
|
74 | 78 | all_cve_details.append({
|
@@ -141,51 +145,53 @@ def search_marc_info(search_term):
|
141 | 145 | component = input(colored("Enter the component (e.g., Apache): ", "cyan"))
|
142 | 146 | version = input(colored("Enter the version (e.g., 4.2.1): ", "cyan"))
|
143 | 147 |
|
| 148 | + # Fetch and display CPEs |
144 | 149 | cpe_strings = find_cpes(component, version)
|
145 |
| - |
146 | 150 | if cpe_strings:
|
147 | 151 | print(colored("CPEs Found:", "green"))
|
148 | 152 | for cpe_string in cpe_strings:
|
149 | 153 | print(colored(f" {cpe_string}", "green"))
|
150 |
| - |
151 |
| - for cpe_string in cpe_strings: |
152 |
| - results = fetch_cve_details(cpe_string) |
153 |
| - if results: |
154 |
| - print(colored("\nCVE Details", "cyan", attrs=["underline"])) |
155 |
| - for result in results: |
156 |
| - cve_id = result["CVE ID"] |
157 |
| - print(colored(f"\nCVE ID: {cve_id}", "white")) |
158 |
| - if result["Short Name"]: |
159 |
| - print(colored(f"Short Name: {result['Short Name']}", "light_blue")) |
160 |
| - print(colored(f"Description: {result['Description']}", "yellow")) |
161 |
| - if result["Weaknesses"]: |
162 |
| - print(colored(f"Weaknesses: {result['Weaknesses']}", "magenta")) |
163 |
| - print(colored(f"Link: {result['Link']}", "blue")) |
164 |
| - github_urls = fetch_github_urls(cve_id) |
165 |
| - if github_urls: |
166 |
| - print(colored("Public Exploit/POC Over Github found:", "red")) |
167 |
| - for url in github_urls: |
168 |
| - print(colored(f" {url}", "blue")) |
169 |
| - else: |
170 |
| - print(colored("Public Exploit/POC Over Github not found, you might need to check manually", "green")) |
171 |
| - print(colored(f"Exploit Status: {result['Exploit Status']}", "red" if result["Exploit Status"] == "Public Exploit Found over Exploit-DB" else "green")) |
172 | 154 | else:
|
173 |
| - print(colored("No CPEs found for the provided component and version.", "red")) |
174 |
| - |
175 |
| - download_links = search_and_extract_download_links(component) |
176 |
| - |
| 155 | + print(colored("No CPEs found. Please try different keywords.", "red")) |
| 156 | + sys.exit(0) |
| 157 | + |
| 158 | + # Search for Packet Storm Security download links |
| 159 | + download_links = search_and_extract_download_links(f"{component} {version}") |
177 | 160 | if download_links:
|
178 |
| - print(colored("\nPossible Exploits on Packet Storm Security:", "cyan", attrs=["underline"])) |
| 161 | + print(colored("\nPublic exploits found over Packet Storm Security", "yellow")) |
179 | 162 | for link in download_links:
|
180 |
| - print(link) |
| 163 | + print(colored(f" {link}", "blue")) |
| 164 | + |
| 165 | + # Search Marc Full Disclosure for exploits |
| 166 | + marc_info = search_marc_info(f"{component} {version}") |
| 167 | + if marc_info: |
| 168 | + print(colored("\nExploits found in Marc Full Disclosure", "yellow")) |
| 169 | + for result in marc_info: |
| 170 | + print(colored(f"{result['Name']}: {result['Link']}", "green")) |
181 | 171 | else:
|
182 |
| - print(colored("No download links found on Packet Storm Security.", "red", attrs=["underline"])) |
183 |
| - |
184 |
| - search_term_marc = f"{component} {version}" |
185 |
| - print(f"\nUsing keyword "+search_term_marc+" for lookup...") |
186 |
| - marc_results = search_marc_info(search_term_marc) |
187 |
| - if marc_results: |
188 |
| - print(colored("\nPossible Exploits:", "cyan", attrs=["underline"])) |
189 |
| - for result in marc_results: |
190 |
| - print(colored(f"\nName: {result['Name']}", "white")) |
191 |
| - print(colored(f"Link: {result['Link']}", "blue")) |
| 172 | + print(colored("\nNo exploits found in Marc Full Disclosure.", "red")) |
| 173 | + |
| 174 | + # Process each CPE string to get CVE details |
| 175 | + for cpe_string in cpe_strings: |
| 176 | + results = fetch_cve_details(cpe_string) |
| 177 | + if results: |
| 178 | + print(colored("\nCVE Details", "cyan", attrs=["underline"])) |
| 179 | + for result in results: |
| 180 | + cve_id = result["CVE ID"] |
| 181 | + print(colored(f"\nCVE ID: {cve_id}", "white")) |
| 182 | + if result["Short Name"]: |
| 183 | + print(colored(f"Short Name: {result['Short Name']}", "magenta")) |
| 184 | + print(colored(f"Description: {result['Description']}", "yellow")) |
| 185 | + print(colored(f"Weaknesses: {result['Weaknesses']}", "red")) |
| 186 | + print(colored(f"Link: {result['Link']}", "blue")) |
| 187 | + |
| 188 | + github_links = fetch_github_urls(cve_id) |
| 189 | + if github_links: |
| 190 | + print(colored("\nExploit/POC Over Github", "yellow")) |
| 191 | + for link in github_links: |
| 192 | + print(colored(f" {link}", "green")) |
| 193 | + else: |
| 194 | + print(colored("\nExploit/POC Over Github: None", "green")) |
| 195 | + print(colored(f"Exploit Status: {result['Exploit Status']}", "red")) |
| 196 | + |
| 197 | + print(colored("Script Execution Completed!", "green", attrs=["underline"])) |
0 commit comments