Guest User

Untitled

a guest
Jan 26th, 2022
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.66 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. Нихуя не надо, просто запускай.
  14.  
  15. Вроде прокси не требуются,ну если возникли проблемы с регой - юзай впн
  16.  
  17. По всем вопросам,багам в тред
  18. КТО БУДЕТ ПИСАТЬ СООБЩЕНИЯ ПО ТИПУ - "КОКОКО ГОВНОКОД","ХРЮХРЮХРЮ ПИТОН";Просьба пойти срать на хабр
  19. Удачного вечера анон!
  20. '''
  21.  
  22. import requests
  23. import string,random,time,re
  24. import undetected_chromedriver.v2 as uc
  25. import warnings
  26. import uuid
  27. warnings.filterwarnings("ignore")
  28.  
  29. banner = """
  30. +-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+ +-+-+-+-+-+
  31. |O|P|E|R|A|T|I|O|N| |B|L|A|C|K| |M|A|M|B|A|
  32. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  33. |B|y| |A|n|o|n| |f|o|r| |2|c|h|.|h|k|      
  34. +-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+      
  35. |V|e|r| |1|.|2|b|                          
  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.             resp = requests.post(f"https://api.mail.tm/accounts")
  60.             if resp.status_code != 200:
  61.                 raise Exception
  62.             resp = resp.json()
  63.             self.mail["email"] = resp["email"]
  64.             self.mail["key"] = resp["key"]
  65.             return True
  66.         except Exception as e:
  67.             print(f"Ошибка при получении ящика!!!\nЛог:{e}")
  68.             return False
  69.  
  70.     def Clear(self):
  71.         try:
  72.             resp = requests.get(f"https://post-shift.ru/api.php?action=deleteall")
  73.             if resp.status_code != 200:
  74.                 raise Exception
  75.             return True
  76.         except Exception as e:
  77.             print(f"Ошибка при Удалении ящиков!!!\nЛог:{e}")
  78.             return False
  79.  
  80.     def getEmailMessage(self, token):
  81.         resp = requests.get('https://api.mail.tm/messages', headers={'Authorization': 'Bearer ' + token})
  82.         if resp.status_code != 200:
  83.             raise Exception
  84.         emails = resp.json()['hydra:member']
  85.         if len(emails) != 0:
  86.             id = emails[0]['id']
  87.             resp = requests.get('https://api.mail.tm/messages/' + id, headers={'Authorization': 'Bearer ' + token})
  88.             if resp.status_code != 200:
  89.                 raise Exception
  90.             return resp.json()['html'][0]
  91.         return None
  92.  
  93.  
  94.     def GetEmailList(self):
  95.         try:
  96.             resp = requests.get(f"https://post-shift.ru/api.php?action=getlist&hash={self.postshift_api_hash}&key={self.mail['key']}")
  97.             if resp.status_code != 200:
  98.                 raise Exception
  99.             return resp.json()
  100.         except Exception as e:
  101.             print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
  102.             return None
  103.  
  104.     def GetEmailText(self):
  105.         try:
  106.             resp = requests.get(f"https://post-shift.ru/api.php?action=getmail&hash={self.postshift_api_hash}&key={self.mail['key']}&id=1")
  107.             if resp.status_code != 200:
  108.                 raise Exception
  109.             return resp.json()
  110.         except Exception as e:
  111.             print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
  112.             return None
  113.     def __init__(self,hash):
  114.         self.postshift_api_hash=hash
  115. def ExtractPwd(message):
  116.     match = re.search(r'href=[\'"]?([^\'" >]+)', message)
  117.     if match:
  118.         return match.group(0).replace('href="',"")
  119.     else:
  120.         return None
  121.  
  122. def GenPassword(min: int = 20, max: int = 20):
  123.     pwd = ""
  124.     special_list = ["!","@","#","$","%"]
  125.     pwd += ''.join(random.choice(string.ascii_uppercase) for i in range(5))
  126.     pwd += ''.join(random.choice(string.ascii_lowercase) for i in range(5))
  127.     pwd += ''.join(random.choice(string.digits) for i in range(5))
  128.     pwd += ''.join(random.choice(special_list) for i in range(5))
  129.     return ''.join(random.sample(pwd,len(pwd)))
  130.  
  131. def main():
  132.     itter = 0
  133.     print(banner)
  134.     # apihash = input("Ввдите api ключ от post shift: ")
  135.     apihash = '542524'
  136.     # if len(apihash) != 32:
  137.     #     print("Неверный api hash!")
  138.     #     return 0
  139.     while True:
  140.         try:
  141.             login = uuid.uuid4().hex.replace('-', '-')
  142.             resp = requests.post(f"https://api.mail.tm/accounts", json={"address": login + "@sinaite.net",
  143.                                                                         "password": "2@k6O8iJ"})
  144.             if resp.status_code != 201:
  145.                 raise Exception
  146.             email = resp.json()['address']
  147.  
  148.             resp = requests.post(f"https://api.mail.tm/token", json={"address": email,
  149.                                                                      "password": "2@k6O8iJ"})
  150.             if resp.status_code != 200:
  151.                 raise Exception
  152.             token = resp.json()['token']
  153.  
  154.             resp = requests.get('https://api.mail.tm/messages', headers={'Authorization': 'Bearer ' + token})
  155.             if resp.status_code != 200:
  156.                 raise Exception
  157.  
  158.             a = Post_shift(apihash)
  159.             driver = uc.Chrome()
  160.             driver.implicitly_wait(5)
  161.             driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  162.             try:
  163.                 driver.find_element_by_xpath('//*[@id="onesignal-slidedown-cancel-button"]').click()
  164.             except:
  165.                 print()
  166.  
  167.             driver.find_element_by_xpath('//*[@id="app"]/div[2]/header/div[1]/div[2]/a').click()
  168.             driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[3]/div/div/div[2]/div/form/div[3]/button').click()
  169.             a.Clear()
  170.             # a.Regestration()
  171.             a.CreateMail()
  172.             # driver.find_element_by_xpath('//*[@id="register_login"]').send_keys(a.mail['email'])
  173.             driver.find_element_by_xpath('//*[@id="register_login"]').send_keys(email)
  174.             driver.find_element_by_xpath('//*[@id="register_password"]').send_keys(GenPassword())
  175.             driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[4]/div/div/div[2]/div/form/button').click()
  176.             print(f"Мыло: {email}")
  177.             while True:
  178.                 time.sleep(1)
  179.  
  180.                 message = a.getEmailMessage(token)
  181.                 if message is not None:
  182.                     break
  183.  
  184.                 # respmails = a.GetEmailList()
  185.                 # if type(respmails) == list:
  186.                 #     if respmails[0]["subject"] == "Регистрация на сайтах Сети городских порталов и Fontanka.ru":
  187.                 #         break
  188.                 #     else:
  189.                 #         print("Ошибка письма!!!")
  190.                 #         return 0
  191.                 print("Ожидаю письмо")
  192.             driver.get(ExtractPwd(message))
  193.             driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  194.             driver.find_element_by_xpath(
  195.                 '//*[@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()
  196.             driver.close()
  197.             itter += 1
  198.             print(f"Успешно!!!Итерация:{itter}")
  199.         except:
  200.             print("shhiiet")
  201.             if driver is not None:
  202.                 try:
  203.                     driver.close()
  204.                 except:
  205.                     print("sssssshhhhhhhhieeet")
  206.         finally:
  207.             time.sleep(10)
  208.  
  209. if __name__ == '__main__':
  210.  
  211.         main()
Add Comment
Please, Sign In to add comment