Advertisement
Guest User

Untitled

a guest
Jan 25th, 2022
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3.  
  4. '''
  5. Гайд по установке
  6. Установленный python 3.7+ (Скомпилировать самому)
  7. потом в терминал
  8. pip install requests
  9. pip install undetected_chromedriver
  10. мейби ещё
  11. pip install selenium
  12.  
  13. Получение api ключа post shift
  14. В адрессную строку браузера:
  15. https://post-shift.ru/api.php?action=reg&email=твояпочта@domain.ru
  16. Если все правильно тогда выведет:
  17. {"hash":"d6be5cce6245b61552cdc5201e0488b2"}
  18. хеш вставлять в виде:
  19. d6be5cce6245b61552cdc5201e0488b2
  20.  
  21. Прокси не требуются, если возникли проблемы с регой - юзай впн
  22.  
  23. '''
  24.  
  25.  
  26.  
  27. import requests
  28. import string,random,time,re
  29. import undetected_chromedriver.v2 as uc
  30. import warnings
  31. warnings.filterwarnings("ignore")
  32.  
  33. banner = """
  34. +-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+ +-+-+-+-+-+
  35. |O|P|E|R|A|T|I|O|N| |K|A|P|O|
  36. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
  37. """
  38. class Post_shift():
  39.  
  40. postshift_api_hash = ""
  41. mail = {"email":"","key":""}
  42. def __generate_random_string(self,min: int = 12, max: int = 16):
  43. return ''.join(random.choice(string.ascii_lowercase) for i in range(random.randint(min, max)))
  44.  
  45. #не используется(защита от дебилов)
  46. def Regestration(self):
  47. try:
  48. resp = requests.get(f"https://post-shift.ru/api.php?action=reg&email={self.__generate_random_string()}@domain.ru")
  49. if resp.status_code != 200:
  50. raise Exception
  51. return True
  52. except Exception as e:
  53. print(f"Ошибка при регистрации на postshift!!!\nЛог:{e}")
  54. return False
  55.  
  56. def CreateMail(self):
  57. try:
  58. resp = requests.get(f"https://post-shift.ru/api.php?action=new&hash={self.postshift_api_hash}")
  59. if resp.status_code != 200:
  60. raise Exception
  61. resp = resp.json()
  62. self.mail["email"] = resp["email"]
  63. self.mail["key"] = resp["key"]
  64. return True
  65. except Exception as e:
  66. print(f"Ошибка при получении ящика!!!\nЛог:{e}")
  67. return False
  68.  
  69. def Clear(self):
  70. try:
  71. resp = requests.get(f"https://post-shift.ru/api.php?action=deleteall")
  72. if resp.status_code != 200:
  73. raise Exception
  74. return True
  75. except Exception as e:
  76. print(f"Ошибка при Удалении ящиков!!!\nЛог:{e}")
  77. return False
  78.  
  79. def GetEmailList(self):
  80. try:
  81. resp = requests.get(f"https://post-shift.ru/api.php?action=getlist&hash={self.postshift_api_hash}&key={self.mail['key']}")
  82. if resp.status_code != 200:
  83. raise Exception
  84. return resp.json()
  85. except Exception as e:
  86. print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
  87. return None
  88.  
  89. def GetEmailText(self):
  90. try:
  91. resp = requests.get(f"https://post-shift.ru/api.php?action=getmail&hash={self.postshift_api_hash}&key={self.mail['key']}&id=1")
  92. if resp.status_code != 200:
  93. raise Exception
  94. return resp.json()
  95. except Exception as e:
  96. print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
  97. return None
  98. def __init__(self,hash):
  99. self.postshift_api_hash=hash
  100. def ExtractPwd(message):
  101. match = re.search(r'href=[\'"]?([^\'" >]+)', message)
  102. if match:
  103. return match.group(0).replace('href="',"")
  104. else:
  105. return None
  106.  
  107. def GenPassword(min: int = 20, max: int = 20):
  108. pwd = ""
  109. special_list = ["!","@","#","$","%"]
  110. pwd += ''.join(random.choice(string.ascii_uppercase) for i in range(5))
  111. pwd += ''.join(random.choice(string.ascii_lowercase) for i in range(5))
  112. pwd += ''.join(random.choice(string.digits) for i in range(5))
  113. pwd += ''.join(random.choice(special_list) for i in range(5))
  114. return ''.join(random.sample(pwd,len(pwd)))
  115.  
  116. def main():
  117. itter = 0
  118. print(banner)
  119. apihash = input("Ввдите api ключ от post shift: ")
  120. if len(apihash) != 32:
  121. print("Неверный api hash!")
  122. return 0
  123. while True:
  124. try:
  125. a=Post_shift(apihash)
  126. driver=uc.Chrome()
  127. driver.implicitly_wait(3)
  128. driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  129. try:
  130. driver.find_element_by_xpath('//*[@id="onesignal-slidedown-cancel-button"]').click()
  131. except:
  132. print()
  133. driver.find_element_by_xpath('//*[@id="app"]/div[2]/header/div[1]/div[2]/a').click()
  134. driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[3]/div/div/div[2]/div/form/div[3]/button').click()
  135. a.Clear()
  136. #a.Regestration()
  137. a.CreateMail()
  138. driver.find_element_by_xpath('//*[@id="register_login"]').send_keys(a.mail['email'])
  139. driver.find_element_by_xpath('//*[@id="register_password"]').send_keys(GenPassword())
  140. driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[4]/div/div/div[2]/div/form/button').click()
  141. print(f"Мыло: {a.mail['email']}")
  142. count_wait=0
  143. drop_flag = 0
  144. while True:
  145. time.sleep(5)
  146. count_wait +=1
  147. respmails = a.GetEmailList()
  148. if type(respmails) == list:
  149. if respmails[0]["subject"] == "Регистрация на сайтах Сети городских порталов и Fontanka.ru":
  150. break
  151. else:
  152. print("Ошибка письма!!!")
  153. return 0
  154. if count_wait == 36:
  155. print("Письмо не пришло")
  156. drop_flag=1
  157. break
  158. print("Ожидаю письмо")
  159. if(drop_flag):
  160. continue
  161. message = a.GetEmailText()
  162. driver.get(ExtractPwd(message["message"]))
  163. driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  164. driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[1]/div/div/div[3]/div[2]/div[1]/div[1]/div[1]/div/div[2]/div[21]/div[2]/div[7]/div[2]/div[2]/div/button').click()
  165. driver.close()
  166. itter+=1
  167. print(f"Успешно!!!Итерация:{itter}")
  168. except Exception as e:
  169. print("неизвестная ошибка")
  170.  
  171. if __name__ == '__main__':
  172. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement