Advertisement
Tryhell

1

Feb 26th, 2024 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. import time
  2. import subprocess
  3. import pyautogui
  4. import pyperclip
  5. import psutil
  6. import os
  7. from selenium import webdriver
  8. from selenium.webdriver.common.by import By
  9. from selenium.webdriver.support.ui import WebDriverWait
  10. from selenium.webdriver.support import expected_conditions as EC
  11. import http.client
  12.  
  13. def send_get_request(url):
  14. conn = http.client.HTTPConnection("185.117.153.138")
  15. conn.request("GET", url)
  16. response = conn.getresponse()
  17. return response.read().decode()
  18.  
  19. def get_cookie_from_file():
  20. with open('cookie.txt', 'r') as file:
  21. return file.read()
  22.  
  23. def update_cookie():
  24. while True:
  25. try:
  26. response = send_get_request("/cookie.php")
  27. if response != "0":
  28. with open('cookie.txt', 'w') as file:
  29. file.write(response)
  30. break
  31. except:
  32. pass
  33. time.sleep(30)
  34. return response
  35.  
  36. def get_link():
  37. try:
  38. response = send_get_request("/link.php")
  39. return response
  40. except:
  41. return ""
  42.  
  43. def get_word():
  44. try:
  45. response = send_get_request("/word.php")
  46. return response
  47. except:
  48. return ""
  49.  
  50. def click_button(x, y):
  51. pyautogui.moveTo(x, y)
  52. pyautogui.click()
  53.  
  54. def scan_pixel(color, x_start=0, y_start=0, x_end=50, y_end=70, retries=20, wait=10):
  55. for attempt in range(retries):
  56. for x in range(x_start, x_end):
  57. for y in range(y_start, y_end):
  58. try:
  59. if pyautogui.pixelMatchesColor(x, y, color, tolerance=10):
  60. return True
  61. except:
  62. pass
  63. time.sleep(wait)
  64. return False
  65.  
  66. def restart_script():
  67. subprocess.call(["pkill", "-9", "Roblox"])
  68. subprocess.call(["pkill", "-9", "Vinegar"])
  69. subprocess.call(["pkill", "-9", "Authentication Failed"])
  70. subprocess.call(["pkill", "-9", "Error"])
  71. time.sleep(2)
  72. subprocess.call(["python3", "/home/oem/Desktop/1.py"])
  73.  
  74. def check_elements(driver):
  75. try:
  76. driver.find_element(By.XPATH, "/html/body/div[3]/div/div[1]/div/div[2]/div[2]/ul/li[1]/a")
  77. return True
  78. except:
  79. pass
  80. try:
  81. driver.find_element(By.XPATH, "//*[@id='logout-button']")
  82. return True
  83. except:
  84. pass
  85. return False
  86.  
  87. def is_disk_space_low(disk_path="/", threshold=95):
  88. disk_usage = psutil.disk_usage(disk_path)
  89. return disk_usage.percent >= threshold
  90.  
  91. def main():
  92. try:
  93. while True:
  94. if is_disk_space_low():
  95. print("Недостаточно места на диске, перезагрузка системы...")
  96. os.system('echo 1 | sudo -S reboot')
  97. time.sleep(60)
  98.  
  99. cookie = get_cookie_from_file()
  100. link = get_link()
  101. if not link:
  102. raise Exception("Не удалось получить ссылку")
  103. restart_script()
  104.  
  105. options = webdriver.ChromeOptions()
  106. options.add_argument("--window-size=1280,720")
  107. options.add_extension('/home/oem/mod.crx') # Добавление расширения
  108. driver = webdriver.Chrome(options=options)
  109. driver.maximize_window()
  110.  
  111. driver.get("https://www.roblox.com")
  112. driver.add_cookie({"name": ".ROBLOSECURITY", "value": cookie, "domain": ".roblox.com", "path": "/"})
  113. driver.get(link)
  114. time.sleep(20)
  115.  
  116. if check_elements(driver):
  117. driver.quit()
  118. update_cookie()
  119. continue
  120.  
  121. play_button_xpath = "//*[@id='game-details-play-button-container']/button"
  122. play_button = WebDriverWait(driver, 20).until(
  123. EC.element_to_be_clickable((By.XPATH, play_button_xpath))
  124. )
  125. play_button.click()
  126. time.sleep(7)
  127. click_button(844, 244)
  128. driver.quit()
  129.  
  130. color = (170, 182, 195)
  131. if not scan_pixel(color):
  132. print("Цвет пикселя не найден.")
  133. driver.quit()
  134. restart_script()
  135. continue
  136. time.sleep(10)
  137.  
  138. word = get_word()
  139. if not word:
  140. raise Exception("Не удалось получить слово")
  141. restart_script()
  142.  
  143. pyperclip.copy(word)
  144. for _ in range(3):
  145. click_button(606, 363)
  146. time.sleep(8)
  147. pyautogui.press('/')
  148. time.sleep(8)
  149. pyautogui.hotkey('ctrl', 'v')
  150. time.sleep(10)
  151. pyautogui.press('enter')
  152. time.sleep(4)
  153.  
  154. restart_script()
  155. except Exception as e:
  156. print(f"Произошла ошибка: {e}")
  157. restart_script()
  158.  
  159. if __name__ == "__main__":
  160. main()
  161.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement