1c7

Scan through random pastebin posts and try and retrieve data

1c7
Dec 3rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. import urllib.request
  2. import random
  3. import string
  4. import time
  5. found = []
  6.  
  7. def randomString(stringLength):
  8.     lettersAndDigits = string.ascii_letters + string.digits
  9.     return ''.join(random.choice(lettersAndDigits) for i in range(stringLength))
  10. timeStart = time.time()
  11. data = int(input("How many urls do you want to run through: "))
  12. print(f"Starting program...")
  13. for i in range(data + 1):
  14.     if i == 0:
  15.         timeEstStart = time.time()
  16.     if i == 10:
  17.         finalEstTime = ((round(time.time() - timeEstStart) * data) / 10) / 60
  18.         print(f"Estimated finshing time: {finalEstTime}mins")
  19.     try:
  20.         url = randomString(8)
  21.         with urllib.request.urlopen(f"https://pastebin.com/raw/{url}") as page:
  22.             data = page.read().decode("utf-8")
  23.             found.append("f{url}")
  24.     except:
  25.         continue
  26. timeEnd = time.time()
  27. finalTime = round(timeEnd - timeStart) / 60
  28. print(f"============== RESULT ==============\nSuccessfully ran through {i} urls\nExecuted in {finalTime}mins (Est: {finalEstTime}mins)\nFound: {found}")
Advertisement
Add Comment
Please, Sign In to add comment