Code:
#CODE BY E1.CODERS
# Import requests library for sending HTTP requests
import requests
# Import BeautifulSoup library for parsing HTML
from bs4 import BeautifulSoup
# Define a list of WordPress sites to scan
sites = ["https://example.com", "https://example.org", "https://example.net"]
# Define a list of sources that publish WordPress vulnerabilities and exploits
sources = [
{
"name": "WPScan",
"url": "[1]",
"selector": ".vuln-list li"
},
{
"name": "NVD",
"url": "[2]",
"selector": ".row tbody tr"
},
{
"name": "Tenable",
"url": "[3]",
"selector": ".search-results .result"
},
{
"name": "Search Engine Journal",
"url": "[4]",
"selector": ".entry-content p"
}
]
# Define a function to get the vulnerabilities and exploits for WordPress 5.8.1 from a given source
def get_vulns(source):
# Send a request to the source URL with the WordPress version as a query parameter
response = requests.get(source["url"], params={"q": "WordPress 5.8.1"})
# Parse the response HTML with BeautifulSoup
soup = BeautifulSoup(response.text, "html.parser")
# Find all the elements that match the source selector
elements = soup.select(source["selector"])
# Loop through each element and extract the relevant information
vulns = []
for element in elements:
# Get the name, cve, exploit and indicator of the vulnerability from the element
# This part may vary depending on the source structure and format
name = element.find("a").text.strip()
cve = element.find("span", class_="cve").text.strip()
exploit = element.find("a", href=True)["href"]
indicator = element.find("span", class_="indicator").text.strip()
# Create a dictionary with the extracted information
vuln = {
"name": name,
"cve": cve,
"exploit": exploit,
"indicator": indicator
}
# Append the dictionary to the vulns list
vulns.append(vuln)
# Return the vulns list
return vulns
# Loop through each site and scan for vulnerabilities
for site in sites:
print(f"Scanning {site} for WordPress 5.8.1 vulnerabilities...")
# Loop through each source and get the vulnerabilities and exploits from it
for source in sources:
print(f"Getting vulnerabilities and exploits from {source['name']}...")
vulns = get_vulns(source)
# Loop through each vulnerability and check if the site is vulnerable
for vuln in vulns:
result = check_vuln(site, vuln)
# Print the result of the scan
if result:
print(f"Vulnerable to {vuln['name']} ({vuln['cve']})")
print(f"Exploit: {vuln['exploit']}")
else:
print(f"Not vulnerable to {vuln['name']} ({vuln['cve']})")
print(f"Scan completed for {site}")