This application automates WhatsApp login through an Android emulator while controlling a SIM gateway for SMS verification. It's designed for legitimate testing and automation purposes.
- SIM Gateway Control: Connect and control SIM gateways via serial communication
- Android Emulator Automation: Start, control, and automate Android emulator
- WhatsApp Login Automation: Automated WhatsApp setup and verification process
- SMS Integration: Automatic SMS code retrieval and entry
- Screenshot Capture: Automatic screenshot capture for debugging
- Comprehensive Logging: Detailed logging with rotation
- Interactive Mode: Command-line interface for testing
- SIM gateway device (supporting AT commands via serial)
- Android SDK with emulator support
- Computer with Windows/Linux/macOS
- Python 3.8+
- Android SDK
- Appium Server
- ADB (Android Debug Bridge)
-
Clone/Download the application:
# Navigate to your project directory cd "your-project-path"
-
Install Python dependencies:
pip install -r requirements.txt
-
Install Android SDK:
- Download Android Studio or Android SDK tools
- Set up ANDROID_HOME environment variable
- Install Android Virtual Device (AVD)
-
Install Appium:
npm install -g appium npm install -g appium-doctor appium-doctor --android # Verify setup -
Setup Android Emulator:
# List available AVDs emulator -list-avds # Create new AVD (if needed) avdmanager create avd -n Pixel_3a_API_30 -k "system-images;android-30;google_apis;x86"
Edit config.ini to match your hardware and environment:
[SIM_GATEWAY]
port = COM3 # Your SIM gateway port
baudrate = 115200
timeout = 30
max_retries = 3
[EMULATOR]
name = WhatsApp_Emulator
port = 5554
package_name = com.whatsapp
activity_name = com.whatsapp.Main
emulator_path = C:\Users\{username}\AppData\Local\Android\Sdk\emulator\emulator.exe
avd_name = Pixel_3a_API_30 # Your AVD name
[WHATSAPP]
phone_verification_timeout = 120
sms_wait_timeout = 60
login_retry_attempts = 3
screenshot_path = ./screenshots/
[LOGGING]
log_level = INFO
log_file = ./logs/app.log
max_log_size = 10485760
backup_count = 5Run the application without arguments for interactive mode:
python main.pyThis will show a menu with options:
- Connect SIM Gateway
- Start Emulator
- Setup WhatsApp
- Send Message
- Run Full Automation
- Get SIM Info
- Get Network Info
- Exit
Run complete automation with command line arguments:
python main.py "+1234567890" "Contact Name" "Test message"Parameters:
phone_number: Phone number for WhatsApp verificationcontact_name(optional): Contact to send test messagetest_message(optional): Message to send
-
Start Appium Server:
appium
-
Ensure SIM Gateway is connected to the specified COM port
-
WhatsApp APK should be installed on the emulator
├── main.py # Main application entry point
├── config.ini # Configuration file
├── requirements.txt # Python dependencies
├── README.md # This file
├── src/
│ ├── __init__.py
│ ├── sim_gateway_controller.py # SIM gateway control
│ ├── emulator_controller.py # Android emulator control
│ └── whatsapp_automation.py # WhatsApp automation logic
├── logs/ # Application logs (auto-created)
└── screenshots/ # Screenshots (auto-created)
- Connects to SIM gateway via serial communication
- Sends AT commands for SIM operations
- Reads and manages SMS messages
- Monitors network status and signal strength
- Starts and manages Android emulator
- Provides ADB connectivity
- Handles app installation and launching
- Supports both Appium and ADB automation
- Handles WhatsApp welcome screens
- Manages permissions and setup flow
- Enters phone number and handles verification
- Automatically retrieves and enters SMS codes
- Supports message sending
-
SIM Gateway Connection Failed:
- Check COM port in Device Manager (Windows)
- Verify SIM gateway is powered and connected
- Try different baudrate settings
-
Emulator Won't Start:
- Verify Android SDK path in config
- Check if AVD exists:
emulator -list-avds - Ensure sufficient disk space and RAM
-
Appium Connection Failed:
- Start Appium server:
appium - Check if port 4723 is available
- Verify Android SDK and ADB setup
- Start Appium server:
-
WhatsApp Automation Issues:
- Check if WhatsApp is installed on emulator
- Verify phone number format
- Check screenshots in ./screenshots/ folder for debugging
Enable debug logging by changing log level in config.ini:
[LOGGING]
log_level = DEBUG- Use only for legitimate testing purposes
- Ensure compliance with WhatsApp Terms of Service
- Protect SIM gateway and phone numbers
- Do not use for spam or unauthorized automation
connect(): Connect to SIM gatewaysend_sms(number, message): Send SMSread_sms_messages(): Read all SMSwait_for_sms(timeout, filter): Wait for specific SMSget_sim_info(): Get SIM card informationget_network_info(): Get network status
start_emulator(): Start Android emulatorconnect_adb(): Connect ADBlaunch_app(package, activity): Launch apptap_coordinates(x, y): Tap screentype_text(text): Type texttake_screenshot(filename): Capture screenshot
setup_whatsapp_login(phone): Complete login processsend_message(contact, message): Send WhatsApp message
For issues and questions:
- Check the logs in
./logs/app.log - Review screenshots in
./screenshots/ - Verify configuration in
config.ini - Ensure all prerequisites are installed
This project is for educational and testing purposes only. Ensure compliance with all applicable laws and terms of service.