Advertisement
Guest User

Kapo Script

a guest
Jan 25th, 2022
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.30 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.         a=Post_shift(apihash)
  125.         driver=uc.Chrome()
  126.         driver.implicitly_wait(3)
  127.         driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  128.         try:
  129.             driver.find_element_by_xpath('//*[@id="onesignal-slidedown-cancel-button"]').click()
  130.         except:
  131.             print()
  132.         driver.find_element_by_xpath('//*[@id="app"]/div[2]/header/div[1]/div[2]/a').click()
  133.         driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[3]/div/div/div[2]/div/form/div[3]/button').click()
  134.         a.Clear()
  135.         #a.Regestration()
  136.         a.CreateMail()
  137.         driver.find_element_by_xpath('//*[@id="register_login"]').send_keys(a.mail['email'])
  138.         driver.find_element_by_xpath('//*[@id="register_password"]').send_keys(GenPassword())
  139.         driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[4]/div/div/div[2]/div/form/button').click()
  140.         print(f"Мыло: {a.mail['email']}")
  141.         while True:
  142.             time.sleep(5)
  143.             respmails = a.GetEmailList()
  144.             if type(respmails) == list:
  145.                 if respmails[0]["subject"] == "Регистрация на сайтах Сети городских порталов и Fontanka.ru":
  146.                     break
  147.                 else:
  148.                     print("Ошибка письма!!!")
  149.                     return 0
  150.             print("Ожидаю письмо")
  151.         message = a.GetEmailText()
  152.         driver.get(ExtractPwd(message["message"]))
  153.         driver.get("https://63.ru/text/education/2022/01/25/70386878/")
  154.         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()
  155.         driver.close()
  156.         itter+=1
  157.         print(f"Успешно!!!Итерация:{itter}")
  158.  
  159. if __name__ == '__main__':
  160.         main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement