Guest User

Untitled

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