Skip to content

error-404-h/api-id-api-hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

🚀 Telegram API Extractor (api-id-api-hash)

A lightweight, powerful, and secure Python library designed to automate the extraction of API_ID and API_HASH from your Telegram account directly via the terminal. Ideal for developers setting up Userbots or working with Pyrogram and Telethon.


🔒 100% Secure & Open Source

  • No Data Collection: This library runs entirely locally on your machine. Your credentials, session tokens, and OTP codes are sent directly and securely to Telegram's official servers.
  • Unencrypted & Transparent: The source code published on PyPI is completely open, unencrypted, and peer-reviewable. Trust through transparency!

✨ Features

  • Fast Extraction: Fetch your API_ID and API_HASH in less than a minute.
  • Interactive CLI: Built-in clean terminal interface with dynamic colored banners and prompts.
  • Zero Configuration: No need to log in to the Telegram web panel manually anymore.

🛠️ Installation

You can install the library directly from PyPI using pip:

pip install api-id-api-hash

🚀 Quick Start / Usage Example ​After installing the library, you can use the interactive script below to extract your API details:

import os
import sys
import time
from api_id_hash import TelegramAPIExtractor

# ANSI Color Codes for Terminal Styling
G = "\033[92m"  
C = "\033[96m"  
Y = "\033[93m"  
R = "\033[91m"  
W = "\033[0m"   

def clear_screen():
    os.system('cls' if os.name == 'nt' else 'clear')

def print_banner():
    compact_banner = f"""\033[91m    ___    ____  ____   __ __ ________  __
   /   |  / __ \/  _/  / //_// ____/\ \/ /
  / /| | / /_/ // /   / ,<  / __/    \  / 
 / ___ |/ ____// /   / /| |/ /___    / /  
/_/  |_/_/   /___/  /_/ |_/_____/   /_/   
                                          \033[0m\033[92m"""
    print(compact_banner)


def main():
    clear_screen()
    print_banner()
    
    extractor = TelegramAPIExtractor()
    
    print(f"\n{C}[?] Target Phone:{W}")
    phone_number = input(f"{G}    > {W}").strip()
    
    print(f"{Y}[*] Connecting...{W}")
    random_hash = extractor.send_auth_password(phone_number)
    
    if random_hash:
        print(f"\n{G}[+] OTP Sent.{W}\n{C}[?] Enter Code:{W}")
        code = input(f"{G}    > {W}").strip()
        
        print(f"{Y}[*] Authorizing...{W}")
        token = extractor.login_with_code(phone_number, random_hash, code)
        
        if token:
            print(f"{Y}[*] Dumping hashes...{W}")
            time.sleep(0.5)
            app_id, app_hash = extractor.get_api_details(token)
            
            if app_id and app_hash:
                print(f"\n{G}[SUCCESS] payload_dumped:{W}")
                print(f"     APP_ID   : {C}{app_id}{W}")
                print(f"     APP_HASH : {C}{app_hash}{W}\n")
            else:
                print(f"{R}[-] Error: No active developer app found.{W}")
        else:
            print(f"{R}[-] Error: Invalid or expired code.{W}")
    else:
        print(f"{R}[-] Error: Connection rejected. Check number format.{W}")

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        print(f"\n{R}[!] Aborted.{W}")
        sys.exit()

📜 License ​This project is licensed under the MIT License - see the LICENSE file for details. ​👨‍💻 Developer ​Developed with ❤️ by error-404-h - Telegram: @error404_h ​Modifying or removing developer credits indicates lack of professional integrity.

About

Securely extract Telegram API_ID and API_HASH directly from the terminal.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors