Skip to content

Commit 384fe98

Browse files
authored
Update threattracer.py
Fetch all possible exploit data.
1 parent 24615d4 commit 384fe98

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

threattracer.py

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
import sys
12
import requests
23
import re
34
from termcolor import colored
45
import json
56
from pyExploitDb import PyExploitDb
67
from bs4 import BeautifulSoup
8+
import subprocess
79

810
art = """
911
_______ _ _ _______
1012
|__ __| | | |__ __|
1113
| | | |__ _ __ ___ __ _| |_ | |_ __ __ _ ___ ___ _ __
12-
| | | '_ \| '__/ _ \/ _` | __|| | '__/ _` |/ __/ _ \ '__|
14+
| | | '_ \| '__/ _ \/ _` | __|| | '__/ _` |/__ / _ \ '__|
1315
| | | | | | | | __/ (_| | |_ | | | | (_| | (_| __/ |
1416
|_| |_| |_|_| \___|\__,_|\__||_|_| \__,_|\___\___|_| Version 2.1
1517
A Script to identify CVE and public exploits using CPE by name & version
@@ -49,6 +51,10 @@ def fetch_cve_details(cpe_string):
4951

5052
response = requests.get(url)
5153

54+
if response.status_code != 200:
55+
print(colored(f"Error: Unable to retrieve CVE data for CPE: {cpe_string}. Status code: {response.status_code}", "red"))
56+
return []
57+
5258
try:
5359
data = response.json()
5460
except json.JSONDecodeError:
@@ -124,11 +130,43 @@ def search_and_extract_download_links(product_name):
124130
download_links.append(f"https://packetstormsecurity.com{href}")
125131

126132
if not download_links:
127-
print(colored("No download links found on Packet Storm Security.", "red"))
133+
print(colored("No download links found on Packet Storm Security.", "red", attrs=["underline"]))
128134
return None
129135

130136
return download_links
131137

138+
def search_marc_info(search_term):
139+
# Make a GET request to the URL
140+
url = f"https://marc.info/?l=full-disclosure&s={search_term}"
141+
response = requests.get(url)
142+
143+
# Check if the request was successful
144+
if response.status_code == 200:
145+
# Parse the HTML content of the page
146+
soup = BeautifulSoup(response.text, 'html.parser')
147+
148+
# Check if the response contains "No hits found for"
149+
if "No hits found for" in soup.get_text():
150+
print(colored("No possible exploits found on Marc.Info.", "yellow", attrs=["underline"]))
151+
else:
152+
# Find all <a> tags within <pre> tags, excluding those with "full-disc" in the text
153+
post_links = soup.find('pre').find_all('a', string=lambda text: "full-disc" not in text)
154+
155+
# Print all names and links
156+
if post_links:
157+
results = []
158+
for link in post_links:
159+
name = link.get_text(strip=True)
160+
link_url = "https://marc.info" + link['href']
161+
results.append({"Name": name, "Link": link_url})
162+
return results
163+
else:
164+
print(colored("No matching results found on Marc.Info.", "yellow"))
165+
else:
166+
print(colored("Failed to retrieve the web page from Marc.Info.", "red"))
167+
print(f"Status code: {response.status_code}")
168+
return None
169+
132170
if __name__ == "__main__":
133171
print(colored("CVE and Exploit Finder Script", "green", attrs=["bold"]))
134172
print("This script searches for CVEs, exploits, and possible 0-Days for any product.\n")
@@ -174,8 +212,18 @@ def search_and_extract_download_links(product_name):
174212
download_links = search_and_extract_download_links(component)
175213

176214
if download_links:
177-
print(colored("\nPossible Exploits on Packet Storm Security:", "cyan"))
215+
print(colored("\nPossible Exploits on Packet Storm Security:", "cyan", attrs=["underline"]))
178216
for link in download_links:
179217
print(link)
180218
else:
181-
print(colored("No download links found on Packet Storm Security.", "red"))
219+
print(colored("No download links found on Packet Storm Security.", "red", attrs=["underline"]))
220+
221+
# Search Marc.Info
222+
search_term_marc = f"{component} {version}"
223+
print(f"\nUsing keyword "+search_term_marc+" for lookup...")
224+
marc_results = search_marc_info(search_term_marc)
225+
if marc_results:
226+
print(colored("\nPossible Exploits:", "cyan", attrs=["underline"]))
227+
for result in marc_results:
228+
print(colored(f"\nName: {result['Name']}", "white"))
229+
print(colored(f"Link: {result['Link']}", "blue"))

0 commit comments

Comments
 (0)