Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- '''
- Гайд по установке
- Установленный python 3.7+ (Скомпилировать самому)
- потом в терминал
- pip install requests
- pip install undetected_chromedriver
- мейби ещё
- pip install selenium
- Получение api ключа post shift
- В адрессную строку браузера:
- https://post-shift.ru/api.php?action=reg&email=твояпочта@domain.ru
- Если все правильно тогда выведет:
- {"hash":"d6be5cce6245b61552cdc5201e0488b2"}
- хеш вставлять в виде:
- d6be5cce6245b61552cdc5201e0488b2
- Прокси не требуются, если возникли проблемы с регой - юзай впн
- '''
- import requests
- import string,random,time,re
- import undetected_chromedriver.v2 as uc
- import warnings
- warnings.filterwarnings("ignore")
- banner = """
- +-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+ +-+-+-+-+-+
- |O|P|E|R|A|T|I|O|N| |K|A|P|O|
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
- """
- class Post_shift():
- postshift_api_hash = ""
- mail = {"email":"","key":""}
- def __generate_random_string(self,min: int = 12, max: int = 16):
- return ''.join(random.choice(string.ascii_lowercase) for i in range(random.randint(min, max)))
- #не используется(защита от дебилов)
- def Regestration(self):
- try:
- resp = requests.get(f"https://post-shift.ru/api.php?action=reg&email={self.__generate_random_string()}@domain.ru")
- if resp.status_code != 200:
- raise Exception
- return True
- except Exception as e:
- print(f"Ошибка при регистрации на postshift!!!\nЛог:{e}")
- return False
- def CreateMail(self):
- try:
- resp = requests.get(f"https://post-shift.ru/api.php?action=new&hash={self.postshift_api_hash}")
- if resp.status_code != 200:
- raise Exception
- resp = resp.json()
- self.mail["email"] = resp["email"]
- self.mail["key"] = resp["key"]
- return True
- except Exception as e:
- print(f"Ошибка при получении ящика!!!\nЛог:{e}")
- return False
- def Clear(self):
- try:
- resp = requests.get(f"https://post-shift.ru/api.php?action=deleteall")
- if resp.status_code != 200:
- raise Exception
- return True
- except Exception as e:
- print(f"Ошибка при Удалении ящиков!!!\nЛог:{e}")
- return False
- def GetEmailList(self):
- try:
- resp = requests.get(f"https://post-shift.ru/api.php?action=getlist&hash={self.postshift_api_hash}&key={self.mail['key']}")
- if resp.status_code != 200:
- raise Exception
- return resp.json()
- except Exception as e:
- print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
- return None
- def GetEmailText(self):
- try:
- resp = requests.get(f"https://post-shift.ru/api.php?action=getmail&hash={self.postshift_api_hash}&key={self.mail['key']}&id=1")
- if resp.status_code != 200:
- raise Exception
- return resp.json()
- except Exception as e:
- print(f"Ошибка при Получении списка сообщений!!!\nЛог:{e}")
- return None
- def __init__(self,hash):
- self.postshift_api_hash=hash
- def ExtractPwd(message):
- match = re.search(r'href=[\'"]?([^\'" >]+)', message)
- if match:
- return match.group(0).replace('href="',"")
- else:
- return None
- def GenPassword(min: int = 20, max: int = 20):
- pwd = ""
- special_list = ["!","@","#","$","%"]
- pwd += ''.join(random.choice(string.ascii_uppercase) for i in range(5))
- pwd += ''.join(random.choice(string.ascii_lowercase) for i in range(5))
- pwd += ''.join(random.choice(string.digits) for i in range(5))
- pwd += ''.join(random.choice(special_list) for i in range(5))
- return ''.join(random.sample(pwd,len(pwd)))
- def main():
- itter = 0
- print(banner)
- apihash = input("Ввдите api ключ от post shift: ")
- if len(apihash) != 32:
- print("Неверный api hash!")
- return 0
- while True:
- try:
- a=Post_shift(apihash)
- driver=uc.Chrome()
- driver.implicitly_wait(3)
- driver.get("https://63.ru/text/education/2022/01/25/70386878/")
- try:
- driver.find_element_by_xpath('//*[@id="onesignal-slidedown-cancel-button"]').click()
- except:
- print()
- driver.find_element_by_xpath('//*[@id="app"]/div[2]/header/div[1]/div[2]/a').click()
- driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[3]/div/div/div[2]/div/form/div[3]/button').click()
- a.Clear()
- #a.Regestration()
- a.CreateMail()
- driver.find_element_by_xpath('//*[@id="register_login"]').send_keys(a.mail['email'])
- driver.find_element_by_xpath('//*[@id="register_password"]').send_keys(GenPassword())
- driver.find_element_by_xpath('//*[@id="app"]/div[2]/div[4]/div/div/div[2]/div/form/button').click()
- print(f"Мыло: {a.mail['email']}")
- count_wait=0
- drop_flag = 0
- while True:
- time.sleep(5)
- count_wait +=1
- respmails = a.GetEmailList()
- if type(respmails) == list:
- if respmails[0]["subject"] == "Регистрация на сайтах Сети городских порталов и Fontanka.ru":
- break
- else:
- print("Ошибка письма!!!")
- return 0
- if count_wait == 36:
- print("Письмо не пришло")
- drop_flag=1
- break
- print("Ожидаю письмо")
- if(drop_flag):
- continue
- message = a.GetEmailText()
- driver.get(ExtractPwd(message["message"]))
- driver.get("https://63.ru/text/education/2022/01/25/70386878/")
- 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()
- driver.close()
- itter+=1
- print(f"Успешно!!!Итерация:{itter}")
- except Exception as e:
- print("неизвестная ошибка")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement