This is a simple and secure Python script to generate a Telegram String Session using the Pyrogram library.
It performs the following actions:
- Authenticates your Telegram account using your API ID and API Hash.
- Generates a string session for Telethon client reusability.
- Sends the generated session to your Telegram Saved Messages.
- Saves the session as a
.txtfile in the same directory.
- ✔️ Easy to use and lightweight
- 🔒 Secure authentication with your API ID and API Hash
- 📬 Sends the session to your Telegram Saved Messages
- 📁 Saves the session as a
.txtfile - 💬 Supports 2FA (Two-Factor Authentication)
- 📜 Pyrogram-based implementation
Follow these steps to get started:
git clone https://github.com/Chamindu-Gayanuka/Pyrogram-String-Session-Generator.gitcd Pyrogram-String-Session-Generatorpip install -r requirements.txt- Visit my.telegram.org.
- Log in with your phone number.
- Click on API Development Tools.
- Create a new application.
- Copy your API ID and API Hash.
python main.py- When prompted, enter your API ID and API Hash.
- The script will generate a string session and send it to your Telegram Saved Messages.
- The session will also be saved as a
.txtfile in the same directory.
- Do not share your API ID, API Hash, or string session with anyone.
- Keep your credentials secure to prevent unauthorized access to your Telegram account.
- This script is for educational purposes only. Use it responsibly and in accordance with Telegram's terms of service.
- Use at your own risk. The author is not responsible for any misuse or damage caused by this script.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.