anonfile-scraper.py 979 B

123456789101112131415161718192021222324252627282930313233343536
  1. import string
  2. import random
  3. import proxy_requests
  4. import threading
  5. import sys
  6. def id_generator(size, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
  7. return ''.join(random.choice(chars) for _ in range(size))
  8. def build_url():
  9. base_url = "https://anonfile.com/"
  10. file_id = id_generator(10)
  11. final_url = base_url + file_id
  12. return final_url
  13. def check_url(outfile):
  14. try:
  15. url = build_url()
  16. request = proxy_requests.ProxyRequests(url)
  17. request.get()
  18. if request.get_status_code() == 200:
  19. print(url)
  20. handle = open(outfile, 'a')
  21. handle.write(url+'\n')
  22. else:
  23. print("Nope. Response Code: "+request.get_status_code())
  24. except Exception as e:
  25. print(e)
  26. return
  27. try:
  28. threads = int(sys.argv[1])
  29. for x in range(threads):
  30. threading.Thread(target=check_url).start()
  31. except Exception as e:
  32. print(f"{sys.argv[0]} [threads]\n")