en
Feedback
EFX TV Linux Tutorials

EFX TV Linux Tutorials

Open in Telegram

The EFX TV Telegram channel can be found at @efxtv2 @efxtv admin @errorfix_tv. For online education only.

Show more
No data
Subscribers
-424 hours
-207 days
-4130 days
Posts Archive
⚠️ Py-Installer ERROR solved Resolution: 📁 Correct the script $ pip install pyinstaller $ pyinstaller --onefile app.py Thanks for donation ☺️ #1 Ask to get answered @errorfix_tv Share for more @efxtv Start Creating PythonTelegramBots

❤️ A day will come, I know it’s near, And all my work will disappear, Locked away, a silent secret, I never let the world see it. Why keep it hidden, why not share? Afraid of judgment, afraid of care, Cheap hands might tear it all apart, But I’d rather let it break my heart. I worked so long, but now I fear, My work will never touch the ear Of those who'd listen, understand, I’m scared to show it, scared to stand. Why keep it hidden, why not share? Afraid of judgment, afraid of care, Cheap hands might tear it all apart, But I’d rather let it break my heart. One day I’ll die, and I’ll be gone, But my work will live on alone, A shadow cast, a quiet plea, "Why didn’t I make it free?" @efxtv ❤️

3 Best Ways to Convert Python Scripts.py to .Exe Files in windows Note: Install Python from Method 1: Using PyInstaller Step 1: Install PyInstaller
$ pip install pyinstaller
Step 2: Navigate to your script’s directory
$ cd path\to\your\script
Step 3: Run PyInstaller
$ pyinstaller --onefile your_script.py
Step 4: Locate the executable
$ path\to\your\script\dist\your_script.exe
Method 2: Using Auto PY to EXE Step 1: Install Auto PY to EXE
$ pip install auto-py-to-exe
Step 2: Run Auto PY to EXE
auto-py-to-exe
Step 3: Configure the settings - The Auto PY to EXE GUI will open. In the GUI, you’ll see various options and settings. - Click on the Browse button and select your Python script file. - Adjust other settings as needed, such as adding additional files or modules, selecting an output directory, and setting other options based on your requirements. Step 4: Select the Compilation Mode - Choose the compilation mode based on whether you want a single executable file or a folder with the executable and supporting files. Step 5: Click “Convert .py to .exe Step 6: Find the output - Once the conversion is complete, you will find the generated .exe file in the specified output directory. Method 3: Using cx_Freeze Step 1: Install cx_Freeze
$ pip install cx_Freeze
Step 2: Create a setup script - Create a setup script (e.g., setup.py) ``` from cx_Freeze import setup, Executable    setup(        name="YourAppName",        version="1.0",        description="Your application description",        executables=[Executable("your_script.py")],    )   ```      Step 3: Run the setup script
$ python setup.py build
Step 4: Locate the executable After running the build command, you can find the executable in the build directory. Source here Download the file here Share for more @efxtv @efxtv2

How to Create a Linux Bootable Pen-drive in Ubuntu CLI (for Ubuntu ISO) Note: (Balena Etcher GUI software can also be used) To create a Linux bootable USB, format the USB using the EXT4 file system. For Windows, use FAT32. # Format USB in different file system (Replace /dev/sdX with the appropriate identifier for your USB drive.) EXT4 File System: sudo mkfs.ext4 /dev/sdX FAT32 File System: sudo mkfs.vfat -n "USB_LABEL" /dev/sdX NTFS File System: sudo mkfs.ntfs -f /dev/sdX exFAT File System: sudo mkfs.exfat /dev/sdX Command to create any bootable disk with specific ISO: (ensure usb file system)
sudo dd bs=4M if=Windows10.iso of=/dev/sda status=progress oflag=sync
# Detailed commands # Step 1: List the USB Stick
sudo fdisk -l
lsblk
# Step 2: Unmount the USB Disk
sudo umount /dev/sda*
# Step 3: Create EXT4 Filesystem
sudo mkfs.ext4 /dev/sda
# Step 4: Create Bootable USB
sudo dd if=ubuntu.iso of=/dev/sda status=progress
How to Create Windows10 Bootable Pen-drive in Ubuntu CLI (for Windows 10 ISO) # Step 1: Unmount the Disk
sudo umount /dev/sda*
# Step 2: Create FAT32 Filesystem
sudo mkfs.vfat -n "WINDOWS10" /dev/sda1
# Step 3: Write ISO to USB
sudo dd bs=4M if=Windows10.iso of=/dev/sda status=progress oflag=sync
# Explanation of Syntax - dd: Data duplicator utility. - bs=4M: Sets the block size to 4 megabytes, meaning dd will read and write data in chunks of 4 MB at a time. - oflag=sync: Ensures that dd writes all output data in a synchronized manner. - mkfs: Command to create a file system. Download the file here Share for more @efxtv @efxtv2

Formatting a USB flash drive for in Linux using the command line interface (CLI): # How to Format a USB Flash Drive for Windows and Linux in CLI # Check the List of Drives and Partitions (List All Block Devices)
lsblk
Note: Identify the correct disk carefully by its size. Selecting the incorrect disk may result in data loss. In my case, the target disk is: - sdb (Disk MOUNT) - sda1 (Partition MOUNT # List Selected Disk and Partitions (Disk on the First Line, Partitions Below)
lsblk -fp /dev/sda
# Before Formatting the Disk, First Unmount It from the Linux Machine
sudo umount /dev/sda1
# Wipe Data from /dev/sda (All Partitions Will Be Deleted)
sudo wipefs -a /dev/sda
# Check the Disk and Observe that the Partition Table Should Be Deleted
sudo fdisk -l /dev/sda
# Create a Partition from Unallocated Space
sudo cfdisk /dev/sda
- Choose label type as DOS - Select New > Enter - Choose Primary > Enter - Select Type > Enter > Choose c W95 FAT32 (LBA) > Enter - Select Write > Enter > Type Yes > Enter - Select Quit # Check the Flash Drive for File System (No Partition Created Yet)
sudo fdisk -l /dev/sda
# Format the Disk Partition with FAT32 File System (To Create the Partition)
sudo mkfs.vfat -n "USBFAT32" /dev/sda1
# Check the File System of the Disk with Partition 1
lsblk -fp /dev/sda
# Format with NTFS File System
sudo mkntfs -Q -L "USBNTFS" /dev/sdb1
# Format with ext4 (Linux-Based) File System
sudo mkfs.ext4 -L "USBEXT4" /dev/sdb1
# Change the File System to Windows Compatible (FAT32)
sudo mkfs.vfat -n "USBFAT32" /dev/sdb1
# Eject the Flash Drive
sudo eject /dev/sdb
Options used in the commands: -n: Sets the volume label for the filesystem being created. -L: Specifies the label for the filesystem (used with mkfs commands). -Q: Performs a quick format (used with NTFS formatting). -a: Wipes all filesystem signatures from the specified device (used with wipefs). -l: Lists partition tables and details (used with fdisk). -f: Forces the operation (used with lsblk to show more details). -p: Prints the UUIDs and labels of the partitions (used with lsblk). Download the file here Share for more @efxtv @efxtv2

### Create Your First Application in Termux Tools Used: 1. Package Names 2. Termux 3. Web Browser 4. Bash Colors 5. EFX TV VIP In this project, you'll learn how to launch any application or package directly from the Command Line Interface (CLI) using Termux. This hands-on experience will help you understand and leverage the power of CLI for your development needs. Why Join Us? - Share and Collaborate: Bring your ideas to the table and collaborate with like-minded enthusiasts. - Real-Time Demonstrations: Gain valuable insights through live project demonstrations that enhance your learning experience. Exclusive Access: To get started with this project and many others, we invite you to join our VIP program. As a VIP member, you'll unlock exclusive content and personalized support to elevate your learning journey. Don't miss out on this opportunity to expand your skills and network with fellow developers. Join VIP today!

Cybersecurity-Books Here you will get awesome collection of mostly all well-known and useful cybersecurity books from beginner level to expert for all cybersecurity positions https://github.com/zealraj/Cybersecurity-Books Share for more @efxtv @efxtv2

Create a telegram bot to scan IP/host/websites (enter the IP and get the fastest open port report) NOTE: This post serves as a demonstration for creating a Python application. I do not endorse spamming or violating the terms or services of any individuals. Create Telegram bot Scan.py: JOIN VIP ⚡️ First, install the necessary libraries:
$ pip install python-telegram-bot==13.7

$ pip install python-nmap
⚡️ Create a file Filename.py ⚡️ Go to BotFather and create a new Telegram Bot ⚡️ Save the script as Filename.py Source
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import nmap

bot = telegram.Bot(token='YOUR_TOKEN')
updater = Updater('YOUR_TOKEN', use_context=True)
dispatcher = updater.dispatcher

nm = nmap.PortScanner()

def start(update, context):
    context.bot.send_message(chat_id=update.effective_chat.id, text="Welcome there ! Please pass the IP or Host.")

def scan(update, context):
    try:
        target = update.message.text

        nm.scan(hosts=target, arguments='-T4 -F')

        scan_result = ''
        for host in nm.all_hosts():
            scan_result += f"Host: {host}\n"
            for proto in nm[host].all_protocols():
                ports = nm[host][proto].keys()
                for port in ports:
                    port_info = nm[host][proto][port]
                    scan_result += f"Port: {port} State: {port_info['state']} Service: {port_info['name']}"
                    if 'product' in port_info:
                        scan_result += f", Version: {port_info['product']}"
                    scan_result += "\n"

        context.bot.send_message(chat_id=update.effective_chat.id, text=scan_result)
    except Exception as e:
        context.bot.send_message(chat_id=update.effective_chat.id, text=f"Error: {str(e)}")

start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)

message_handler = MessageHandler(Filters.text & ~Filters.command, scan)
dispatcher.add_handler(message_handler)

updater.start_polling()
updater.idle()
⚡️ Execute the 'Scan.py' script, and visit your Telegram bot, type '/start' to receive the welcome message. ⚡️ Pass the IP/host and get open ports, service and versions. #nmap #python_telegram_bot_source_codes #python_Telegram_Bot

Essential Tools for Red Team Operations In the realm of Red Teaming, utilizing advanced tools is crucial for effectively simulating threats and identifying vulnerabilities. Below is a curated list of key resources that can enhance your assessments and fortify security measures: 1. Cobalt Strike - A comprehensive platform for adversary simulations, it offers functionalities from initial access to post-exploitation. Tailor it with scripts to fit various operational scenarios. 2. Metasploit Framework - An open-source platform designed for developing, testing, and executing exploits. It features thousands of modules addressing various vulnerabilities and supports payload creation and privilege escalation. 3. Empire - A versatile post-exploitation framework that uses both PowerShell and Python agents, facilitating operations across different operating systems. It enables remote script execution, file manipulation, and persistence strategies. 4. BloodHound - A tool for Active Directory enumeration that helps visualize and assess AD environments. It identifies potential attack paths to escalate privileges using graph theory principles. 5. SilentTrinity - A C#/.NET tool for post-exploitation, designed to operate stealthily by using in-memory payloads and supporting lateral movement and credential extraction. 6. SharpHound & CrackMapExec - SharpHound collects data for BloodHound, mapping out AD environments. CrackMapExec acts as a multifunctional tool for network penetration testing, allowing for user enumeration and credential validation. 7. Pupy - A stealthy remote administration tool compatible with multiple platforms (Windows, Linux, macOS, Android), focusing on post-exploitation tasks. 8. Mimikatz - A vital tool for extracting credentials and Kerberos tickets, crucial for lateral movement and maintaining access. 9. Nishang - A collection of PowerShell scripts for offensive operations, covering areas like exploitation, privilege escalation, and credential collection. 10. Sliver - An open-source framework for adversary emulation that supports various command and control (C2) protocols and customizable payloads for Red Team engagements. 11. Covenant - A .NET-based C2 framework featuring in-memory task execution and a user-friendly web interface, designed to help evade detection. 12. Impacket - A suite of Python tools for network protocol interaction, ideal for exploiting SMB-related vulnerabilities. Notable scripts include those for remote execution and credential dumping. Best Practices for Tool Utilization - Prioritize in-memory execution and obfuscation to enhance stealth. - Customize scripts to circumvent security measures. - Ensure operational security with encrypted communications and dynamic C2 setups. - Regularly clean up traces to minimize the risk of detection. By leveraging these tools and adhering to best practices, Red Teamers can effectively identify vulnerabilities and bolster organizational defenses. ━━━━━━━━━━━━━━━━━━━━━━━━━ ♥️  Telegram Channel - @efxtv 🏮 ━━━━━━━━━━━━━━━━━━━━━━━━━

▬ | EFX Tv Education Group 💳| Learn Ethical Hacking Training 📆| 98℅ Demo  📥| 02% Theory   🗺| DM: https://t.me/efxtv/3717 📹| Live Education And Playground ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬ EFX Educational GROUP CONTENT: ⭕️ | Payloads ⭕️ | Multiple Exploitation Methods ⭕️ | FUD DropExp ⭕️ | Post exploitation ⭕️ | CTF, Bug Bounty ⭕️ | EFXTv Tool Pack ⭕️ | Remote Code Execution ⭕️ | Exploit Via Link and Binary ⭕️ | RATs, Malware, etc For Practice ⭕️ | VPLE (Linux) ⭕️ | 1M+ Courses and Updates ⭕️ | Discussion and Support Center ⭕️ | Portable OS Plug and Play ⭕️ | Playground Powered With      ⌨️ Premium  Kali Tools      ⌨️ Premium Parrot OS hacks      ⌨️ Premium Black Box 📦       ⌨️ Premium Ubuntu Base      ⌨️ Premium Termux Hacks      ⌨️ 30+(Linux distribution) ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬ One-time fee lifetime access: 🍓 Free Tending Tools 🍓 Free VPS / Virtual PC 🍓 Free Exploits 🍓 Free Tutorials 🍓 Free Live Classes and Discussion 🍓 Free Docx 🔥🔥🔥🔥JOIN NOW🔥🔥🔥🔥 Pay and Get Approved 👇👇👇👇 ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬

▬ | EFX Tv Education Group 💳| Learn Ethical Hacking Training 📆| 98℅ Demo  📥| 02% Theory   🗺| DM: https://t.me/efxtv/3717 📹| Live Education And Playground ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬ EFX Educational GROUP CONTENT: ⭕️ | Payloads ⭕️ | Multiple Exploitation Methods ⭕️ | FUD DropExp ⭕️ | Post exploitation ⭕️ | CTF, Bug Bounty ⭕️ | EFXTv Tool Pack ⭕️ | Remote Code Execution ⭕️ | Exploit Via Link and Binary ⭕️ | RATs, Malware, etc For Practice ⭕️ | VPLE (Linux) ⭕️ | 1M+ Courses and Updates ⭕️ | Discussion and Support Center ⭕️ | Portable OS Plug and Play ⭕️ | Playground Powered With      ⌨️ Premium  Kali Tools      ⌨️ Premium Parrot OS hacks      ⌨️ Premium Black Box 📦       ⌨️ Premium Ubuntu Base      ⌨️ Premium Termux Hacks      ⌨️ 30+(Linux distribution) ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬ One-time fee lifetime access: 🍓 Free Tending Tools 🍓 Free VPS / Virtual PC 🍓 Free Exploits 🍓 Free Tutorials 🍓 Free Live Classes and Discussion 🍓 Free Docx 🔥🔥🔥🔥JOIN NOW🔥🔥🔥🔥 Pay and Get Approved 👇👇👇👇 ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬

✨ Wepik (Templates for Insta, FB, more) Frew templates for your social media work. 🔗 https://wepik.com/ #TemplateGenerator #
✨ Wepik (Templates for Insta, FB, more) Frew templates for your social media work. 🔗 https://wepik.com/ #TemplateGenerator #best_AI_tools

IP Port Extractor for Craxs RAT APK (Android Remote Tool) ✨ JOIN VIP (Fix errors and add more features)
import os
import base64
import hashlib
import tempfile
import glob
import re
import subprocess
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext

# Replace this with your actual bot token
TELEGRAM_BOT_TOKEN = 'CHANGE_ME_AUTH'

def calculate_md5(file_path):
    hash_md5 = hashlib.md5()
    with open(file_path, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()

def decode_base64(encoded_str):
    padded_str = encoded_str + '=' * (-len(encoded_str) % 4)
    decoded_bytes = base64.b64decode(padded_str)
    return decoded_bytes.decode('utf-8')

def extract_ips_and_ports_from_apk(apk_path):
    md5_hash = calculate_md5(apk_path)
    results = []
    
    with tempfile.TemporaryDirectory() as temp_dir:
        result = subprocess.run(['jadx', '--no-res', '-d', temp_dir, apk_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        if result.returncode != 0:
            return "Error: jadx failed to decompile the APK."
        
        java_files = glob.glob(os.path.join(temp_dir, '**', '*.java'), recursive=True)
        client_host_pattern = re.compile(r'public\s+static\s+String\s+ClientHost\s*=\s*"([A-Za-z0-9+/=]+)"')
        client_port_pattern = re.compile(r'public\s+static\s+String\s+ClientPort\s*=\s*"([A-Za-z0-9+/=]+)"')

        for file_path in java_files:
            with open(file_path, 'r', encoding='utf-8') as file:
                content = file.read()
                
                host_matches = client_host_pattern.findall(content)
                port_matches = client_port_pattern.findall(content)
                
                if host_matches and port_matches:
                    host_base64 = host_matches[0]
                    port_base64 = port_matches[0]
                    
                    try:
                        decoded_host = decode_base64(host_base64)
                        decoded_port = decode_base64(port_base64)
                        message = (f"IP: {decoded_host}\n"
                                   f"Port: {decoded_port}\n"
                                   f"Join: @EFXTV")
                        results.append(message)
                    except Exception as e:
                        results.append(f"Error decoding base64 strings: {e}")
        
    return "\n\n".join(results) if results else "No IPs or Ports found."

async def start(update: Update, context: CallbackContext):
    await update.message.reply_text("Send me an APK file and I'll extract the IP and port information.")

async def handle_document(update: Update, context: CallbackContext):
    file = update.message.document
    file_id = file.file_id
    file_name = file.file_name
    file_path = os.path.join(tempfile.gettempdir(), file_name)

    try:
        # Get the file object
        telegram_file = await context.bot.get_file(file_id)
        # Download the file
        await telegram_file.download_to_drive(file_path)
        # Process the APK file
        message = extract_ips_and_ports_from_apk(file_path)
        # Send the result back to the user
        await update.message.reply_text(message)
    except Exception as e:
        await update.message.reply_text(f"An error occurred: {e}")
    finally:
        # Clean up the temporary file
        if os.path.exists(file_path):
            os.remove(file_path)

def main():
    application = Application.builder().token(TELEGRAM_BOT_TOKEN).build()
    
    application.add_handler(CommandHandler('start', start))
    application.add_handler(MessageHandler(filters.Document.MimeType("application/vnd.android.package-archive"), handle_document))

    application.run_polling()

if __name__ == '__main__':
    main()
#telegrambot #python_telegram_bot_source_codes #python_telegram_bot_source_codes

How to Enlarge a Virtual Machine’s Disk Size in VirtualBox (Windows) ⚡️ If you need to increase the disk size of a virtual machine in VirtualBox, follow these steps: 1. Open VirtualBox and select the desired virtual machine. 2. Right-click on the machine name. - For Linux users: Select Show in File Manager. - For Windows users: Select Show in Explorer. 3. This will open the location where the .vdi file is stored on your system. 4. Select the virtual machine you want to modify, and click on Settings. 5. Click on the Storage tab. 6. Right-click on the .vdi file and select Remove Attachment. 7. Navigate to the folder where the .vdi file exists: - For Linux users: Open a terminal in the same directory and run the following command (51200 represents 50 GB):
     VBoxManage modifyhd /path/to/your/Windows10_custom-disk001.vdi --resize 51200
     
- For Windows users: Open Command Prompt (CMD) in the same folder and run the command:
     VBoxManage.exe modifymedium "path\to\your\Windows10_custom-disk001.vdi" --resize 51200
     
8. Return to VirtualBox: Select the machine, go to Settings, then Storage, and click on Add to attach the modified .vdi file. Final Steps After resizing the disk, you may need to boot your virtual machine and use a partitioning tool (like gparted) to expand the filesystem and make use of the additional space. By following these steps, you can effectively increase the disk size of your VirtualBox virtual machine. If you have any questions or run into issues, feel free to ask for help! Admin: https://t.me/efxtv/3717

A simple real-time chat application built with Flask and Socket.IO. This application allows multiple users to chat in separate rooms identified by unique URL hashes. Users can also upload images to share within the chat. ⭐ Visit to install RealTimeChatSyatem.py Admin: https://t.me/efxtv/3717

📢 How to Enable Noise Cancellation Microphone in Linux Follow these simple steps to get your USB microphone working with noise cancellation: 1. Connect your USB microphone to your machine. 2. Download the script:
   wget https://raw.githubusercontent.com/efxtv/NoiceEFX/refs/heads/main/nca
   chmod +x nca
   bash nca
   
3. Activate the noise cancellation microphone: Simply run:
   bash nca
   
4. Create a shortcut for easier access:
   ln -s $PWD/nca /bin/nca
   
5. Close the current terminal and type `nca` to activate the microphone. 🔍 How to check the microphone? - Go to Settings > Sound > Input Device and choose the very last device. Cheers! 🎤✨ Join @EFXTV

Live schedule, 09:30 PM IST Let's talking 👋😀

IP Port Extractor for Craxs RAT APK (Android Remote Tool) ✨ JOIN VIP (Fix errors and add more features)
import os
import base64
import hashlib
import tempfile
import glob
import re
import subprocess
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters, CallbackContext

# Replace this with your actual bot token
TELEGRAM_BOT_TOKEN = 'CHANGE_ME_AUTH'

def calculate_md5(file_path):
    hash_md5 = hashlib.md5()
    with open(file_path, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()

def decode_base64(encoded_str):
    padded_str = encoded_str + '=' * (-len(encoded_str) % 4)
    decoded_bytes = base64.b64decode(padded_str)
    return decoded_bytes.decode('utf-8')

def extract_ips_and_ports_from_apk(apk_path):
    md5_hash = calculate_md5(apk_path)
    results = []
    
    with tempfile.TemporaryDirectory() as temp_dir:
        result = subprocess.run(['jadx', '--no-res', '-d', temp_dir, apk_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        if result.returncode != 0:
            return "Error: jadx failed to decompile the APK."
        
        java_files = glob.glob(os.path.join(temp_dir, '**', '*.java'), recursive=True)
        client_host_pattern = re.compile(r'public\s+static\s+String\s+ClientHost\s*=\s*"([A-Za-z0-9+/=]+)"')
        client_port_pattern = re.compile(r'public\s+static\s+String\s+ClientPort\s*=\s*"([A-Za-z0-9+/=]+)"')

        for file_path in java_files:
            with open(file_path, 'r', encoding='utf-8') as file:
                content = file.read()
                
                host_matches = client_host_pattern.findall(content)
                port_matches = client_port_pattern.findall(content)
                
                if host_matches and port_matches:
                    host_base64 = host_matches[0]
                    port_base64 = port_matches[0]
                    
                    try:
                        decoded_host = decode_base64(host_base64)
                        decoded_port = decode_base64(port_base64)
                        message = (f"IP: {decoded_host}\n"
                                   f"Port: {decoded_port}\n"
                                   f"Join: @EFXTV")
                        results.append(message)
                    except Exception as e:
                        results.append(f"Error decoding base64 strings: {e}")
        
    return "\n\n".join(results) if results else "No IPs or Ports found."

async def start(update: Update, context: CallbackContext):
    await update.message.reply_text("Send me an APK file and I'll extract the IP and port information.")

async def handle_document(update: Update, context: CallbackContext):
    file = update.message.document
    file_id = file.file_id
    file_name = file.file_name
    file_path = os.path.join(tempfile.gettempdir(), file_name)

    try:
        # Get the file object
        telegram_file = await context.bot.get_file(file_id)
        # Download the file
        await telegram_file.download_to_drive(file_path)
        # Process the APK file
        message = extract_ips_and_ports_from_apk(file_path)
        # Send the result back to the user
        await update.message.reply_text(message)
    except Exception as e:
        await update.message.reply_text(f"An error occurred: {e}")
    finally:
        # Clean up the temporary file
        if os.path.exists(file_path):
            os.remove(file_path)

def main():
    application = Application.builder().token(TELEGRAM_BOT_TOKEN).build()
    
    application.add_handler(CommandHandler('start', start))
    application.add_handler(MessageHandler(filters.Document.MimeType("application/vnd.android.package-archive"), handle_document))

    application.run_polling()

if __name__ == '__main__':
    main()
#telegrambot #python_telegram_bot_source_codes #python_telegram_bot_source_codes

For educational purposes only 🤟 Free for our premium users. Provide the license soon. @errorfix_tv