Skip to content

Create 500scan.py #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions 500scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import urllib.parse

# Define the target website URL
target_url = "https://www.example.com"

# Send a GET request to the target URL and parse the response HTML
response = requests.get(target_url)
html_content = response.content.decode("utf-8")

# Parse the HTML to find all links to internal pages on the target website
internal_links = set()
for link in html_content.split("href="):
if link.startswith('"') or link.startswith("'"):
link = link[1:]
if link.endswith('"') or link.endswith("'"):
link = link[:-1]
if link.startswith("/") or link.startswith(target_url):
internal_links.add(link)
elif link.startswith("http"):
parsed_link = urllib.parse.urlparse(link)
if parsed_link.netloc == urllib.parse.urlparse(target_url).netloc:
internal_links.add(link)

# Send GET requests to all detected endpoints and print any 5xx responses
for endpoint in internal_links:
try:
response = requests.get(endpoint)
if response.status_code >= 500:
print(f"{endpoint} returned status code {response.status_code}")
except requests.exceptions.RequestException:
print(f"Error requesting {endpoint}")