Advertisement
Eccat

Untitled

Jan 10th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. import random
  2. import requests
  3. import threading
  4. import faker
  5.  
  6. from flask import Flask
  7.  
  8. app = Flask(__name__)
  9. fake = faker.Faker()
  10.  
  11. views = 0
  12.  
  13.  
  14. def add_view():
  15. global views
  16. views += 1
  17.  
  18.  
  19. request = requests.get("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt")
  20. with open("/tmp/proxy.txt", "w") as f:
  21. f.write(request.text)
  22.  
  23.  
  24. def botter(username, id):
  25. headers = {
  26. "User-Agent": fake.user_agent(),
  27. "Accept": "*/*",
  28. "Accept-Language": "en-US,en;q=0.5",
  29. "Accept-Encoding": "gzip, deflate, br",
  30. "X-Requested-With": "XMLHttpRequest",
  31. "Connection": "keep-alive",
  32. "Referer": "https://scratch.mit.edu/",
  33. "Pragma": "no-cache",
  34. "Cache-Control": "no-cache",
  35. "TE": "Trailers"
  36. }
  37. with open("/tmp/proxy.txt", "r") as f:
  38. proxies = f.read().splitlines()
  39. while True:
  40. # Get random proxy
  41. for proxy in random.choices(proxies, k=1):
  42. try:
  43. r = requests.options(f"https://api.scratch.mit.edu/users/{username}/projects/{id}/views",
  44. proxies={"https": proxy, "http": proxy}, timeout=7)
  45. q = requests.post(f"https://api.scratch.mit.edu/users/{username}/projects/{id}/views",
  46. proxies={"https": proxy, "http": proxy}, headers=headers, timeout=7)
  47. if r.status_code == 200 and q.status_code == 200:
  48. add_view()
  49. print(f"View added! Total views: {views}")
  50. else:
  51. print(f"Error: {r.status_code} {q.status_code}")
  52. proxies.remove(proxy)
  53. except Exception as e:
  54. if 'HTTPSConnectionPool' in str(e):
  55. proxies.remove(proxy)
  56. elif 'Connection aborted' in str(e):
  57. proxies.remove(proxy)
  58. else:
  59. print(e)
  60. proxies.remove(proxy)
  61.  
  62.  
  63. # Create an api route to start the function botter get the username and id from the url
  64. @app.route("/<username>/<id>")
  65. def start(username, id):
  66. # Star a bunch of threads
  67. for i in range(1000000):
  68. threading.Thread(target=botter, args=(username, id)).start()
  69. return "Started!"
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement