Skip to content

Instantly share code, notes, and snippets.

@mertcangokgoz
Created September 18, 2022 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mertcangokgoz/59facff456b2e1c0f7027a779dff8325 to your computer and use it in GitHub Desktop.
Save mertcangokgoz/59facff456b2e1c0f7027a779dff8325 to your computer and use it in GitHub Desktop.
import string
import time
import warnings
from pathlib import Path
from random import SystemRandom
import requests # pip install requests
import requests_random_user_agent # noqa: F401 # pip install requests-random-user-agent
from urllib3.exceptions import InsecureRequestWarning
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
BASE_DIR = Path(__file__).resolve(strict=True).parent
def justpasteit_sniffer() -> None:
length = 5
links = "".join(
[
SystemRandom().choice(string.ascii_letters + string.digits)
for _ in range(length)
]
)
justpaste_session = requests.Session()
url = f"https://justpaste.it/{links}"
response = justpaste_session.get(url, verify=False)
if response.ok:
with open(f"{BASE_DIR}/urls.txt", "a", encoding="utf-8") as valid_links:
valid_links.write(f"https://justpaste.it/{links}\n")
valid_links.close()
else:
print("Maybe server is a throttling you, wait 5 minutes and try again.")
time.sleep(300)
justpasteit_sniffer()
justpaste_session.close()
for _ in range(100):
justpasteit_sniffer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment