Last active
April 12, 2025 01:47
-
-
Save AgentLoneStar007/60da273e84adc528acdc21fae1f9ae71 to your computer and use it in GitHub Desktop.
A simple script I made to map the files of a Steam scam site.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import secrets | |
import requests | |
from os.path import exists | |
# A function to generate URLs with the random character patterns seen on the website | |
def generateURLsToTest(number_to_generate, length=44) -> set: | |
"""Generates a list of URLs to test for the scam site.""" | |
# Return an empty list if the number to generate is zero or less | |
if number_to_generate <= 0: | |
return set() | |
# Create an empty list for the URLs | |
generated_strings: set[str] = set() | |
# Generate the URLs and add them to the list | |
while len(generated_strings) < number_to_generate: | |
generated_strings.add(f"https://staemcomunmutty.com/{secrets.token_hex(length // 2)}") | |
return generated_strings | |
if __name__ == "__main__": | |
# Create a list of URLs to query | |
urls_to_test: set[str] = generateURLsToTest(number_to_generate=80000, length=44) | |
# And create a list to store all the URLs we already queried | |
tried_urls: set[str] = set() | |
# Check if the tried URLs file exists | |
if exists("tried_urls_file.txt"): | |
# If it does, open it up and make sure we have no duplicates(highly unlikely) | |
with open("tried_urls_file.txt", 'r') as file: | |
tried_urls_file: set = set(file.read().split('\n')) | |
file.close() | |
for url in urls_to_test: | |
if url in tried_urls: | |
urls_to_test.pop() | |
try: | |
# Go through every URL generated | |
for url in urls_to_test: | |
# Create a status code variable to store the response's status code | |
status_code: int | None = None | |
try: | |
# Create and send a request to the server | |
request = requests.request(url=url, method="GET") | |
status_code = request.status_code | |
# Handle if we did get an OK response | |
if status_code == 200: | |
if exists("successful_queries.txt"): | |
with open("successful_queries.txt", 'a') as file: | |
file.write(f"{url}\n") | |
print(f"URL {url} returned a status of 200.") | |
# Handle if we got a non-"not found"-response | |
elif status_code != 404: | |
if exists("semi_successful_queries.txt"): | |
with open("semi_successful_queries.txt", 'a') as file: | |
file.write(f"{url} - Response Code {status_code}\n") | |
print(f"URL {url} returned a status of {status_code}.") | |
else: | |
# Handle if we didn't get a non-200 response code | |
request.raise_for_status() | |
except Exception as error: | |
print(f"Query of {url} failed with HTTP code {status_code}.") | |
# Add the URL to the tried URLs list | |
tried_urls.add(url) | |
except KeyboardInterrupt: | |
print("Saving progress and stopping!") | |
with open("tried_urls_file.txt", 'a+') as file: | |
for url in tried_urls: | |
file.write(f"{url}\n") | |
file.close() | |
print("Done.") | |
exit() | |
except Exception as error: | |
print(f"Encountered the following error: {error}") | |
print("Saving progress and stopping!") | |
with open("tried_urls_file.txt", 'a+') as file: | |
for url in tried_urls: | |
file.write(f"{url}\n") | |
file.close() | |
print("Done.") | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment