Overview
TheTermuxManager class (core/termux_manager.py:8) provides Android-native file operations when running directly on an Android device via Termux, bypassing the need for ADB.
Class Definition
core/termux_manager.py
Constructor
__init__()
Directory where backups will be copied
output_dir: Output directory for backupsos_type: Always set to ‘termux’
Key Differences from DeviceManager
No ADB Dependency
Direct filesystem access without ADB bridge
Internal Storage
Access to internal storage with proper permissions
File Operations
Uses
shutil.copy2() instead of ADB pullLocal Execution
Runs natively on the Android device itself
Device Information
get_devices()
Returns localhost as the device (Termux runs locally).
Always returns [“localhost (Termux)“]
get_detailed_device_info()
Retrieves basic device information using Python’s platform module.
Ignored (always localhost)
Dictionary with limited device info:
- Serial: ‘localhost’
- Model, Brand: From platform module
- Storage: From shutil.disk_usage()
- Other fields: ‘Unknown’ or placeholder values
get_users()
Returns primary user (user 0).
Always returns a list with one user: id ‘0’ and name ‘Owner’
check_packages()
Returns all known WhatsApp packages (cannot verify without root).
Returns [‘com.whatsapp’, ‘com.whatsapp.w4b’]
Backup Discovery
find_backups()
Scans accessible storage locations for WhatsApp backups.
Ignored (localhost)
User ID (usually “0”)
Package name (com.whatsapp or com.whatsapp.w4b)
List of backup dictionaries with path, name, and size
- WhatsApp:
WhatsApp/Databases,Android/media/com.whatsapp/WhatsApp/Databases - Business:
WhatsApp Business/Databases,Android/media/com.whatsapp.w4b/WhatsApp Business/Databases
find_media()
Locates WhatsApp Media folder in accessible storage.
Ignored (localhost)
User ID
Package name
Path to Media folder, or empty string if not found
File Operations
dump_backup()
Copies a backup file from storage to output directory.
Ignored (localhost)
Full path to backup file
User profile ID
“messenger” or “business”
Print status messages
Local path to copied file, or empty string on failure
copy2() to preserve metadata (timestamps, permissions).
dump_media_with_progress()
Copies Media folder with progress tracking.
Ignored (localhost)
Path to Media folder
Local directory to save media
True if successful, False otherwise
- Walk directory tree with
os.walk() - Count total files
- Copy each file with
shutil.copy2() - Show progress with tqdm
- Preserve directory structure
Storage Access
Setup Storage Access:~/storage/ symlinks to Android storage:
~/storage/shared→/sdcard~/storage/dcim→/sdcard/DCIM~/storage/downloads→/sdcard/Download
Usage Example
Environment Detection
The main application detects Termux environment:main.py:30-32
main.py:34-40
Advantages
No PC Required
Run forensic analysis directly on the target device
Internal Storage Access
Access internal storage with proper permissions
Faster Operations
No USB transfer overhead, direct file access
Portable
Entire forensic toolkit on a mobile device
Limitations
Related
Android/Termux Guide
Complete setup guide for Termux
DeviceManager
ADB-based device management
Backup Extraction
Extract backups from devices
Troubleshooting
Solve common Termux issues
