Skip to content

RoadToMythicGlory/Whatsapp-Registrator-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp SIM Gateway Automation

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.

Features

  • 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

Prerequisites

Hardware Requirements

  • SIM gateway device (supporting AT commands via serial)
  • Android SDK with emulator support
  • Computer with Windows/Linux/macOS

Software Requirements

  • Python 3.8+
  • Android SDK
  • Appium Server
  • ADB (Android Debug Bridge)

Installation

  1. Clone/Download the application:

    # Navigate to your project directory
    cd "your-project-path"
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Install Android SDK:

    • Download Android Studio or Android SDK tools
    • Set up ANDROID_HOME environment variable
    • Install Android Virtual Device (AVD)
  4. Install Appium:

    npm install -g appium
    npm install -g appium-doctor
    appium-doctor --android  # Verify setup
  5. 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"

Configuration

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 = 5

Usage

Interactive Mode

Run the application without arguments for interactive mode:

python main.py

This will show a menu with options:

  1. Connect SIM Gateway
  2. Start Emulator
  3. Setup WhatsApp
  4. Send Message
  5. Run Full Automation
  6. Get SIM Info
  7. Get Network Info
  8. Exit

Command Line Mode

Run complete automation with command line arguments:

python main.py "+1234567890" "Contact Name" "Test message"

Parameters:

  • phone_number: Phone number for WhatsApp verification
  • contact_name (optional): Contact to send test message
  • test_message (optional): Message to send

Prerequisites Setup

  1. Start Appium Server:

    appium
  2. Ensure SIM Gateway is connected to the specified COM port

  3. WhatsApp APK should be installed on the emulator

Project Structure

├── 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)

Key Components

SIM Gateway Controller

  • Connects to SIM gateway via serial communication
  • Sends AT commands for SIM operations
  • Reads and manages SMS messages
  • Monitors network status and signal strength

Emulator Controller

  • Starts and manages Android emulator
  • Provides ADB connectivity
  • Handles app installation and launching
  • Supports both Appium and ADB automation

WhatsApp 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

Troubleshooting

Common Issues

  1. SIM Gateway Connection Failed:

    • Check COM port in Device Manager (Windows)
    • Verify SIM gateway is powered and connected
    • Try different baudrate settings
  2. Emulator Won't Start:

    • Verify Android SDK path in config
    • Check if AVD exists: emulator -list-avds
    • Ensure sufficient disk space and RAM
  3. Appium Connection Failed:

    • Start Appium server: appium
    • Check if port 4723 is available
    • Verify Android SDK and ADB setup
  4. WhatsApp Automation Issues:

    • Check if WhatsApp is installed on emulator
    • Verify phone number format
    • Check screenshots in ./screenshots/ folder for debugging

Debug Mode

Enable debug logging by changing log level in config.ini:

[LOGGING]
log_level = DEBUG

Security Considerations

  • 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

API Reference

SIMGatewayController Methods

  • connect(): Connect to SIM gateway
  • send_sms(number, message): Send SMS
  • read_sms_messages(): Read all SMS
  • wait_for_sms(timeout, filter): Wait for specific SMS
  • get_sim_info(): Get SIM card information
  • get_network_info(): Get network status

EmulatorController Methods

  • start_emulator(): Start Android emulator
  • connect_adb(): Connect ADB
  • launch_app(package, activity): Launch app
  • tap_coordinates(x, y): Tap screen
  • type_text(text): Type text
  • take_screenshot(filename): Capture screenshot

WhatsAppAutomation Methods

  • setup_whatsapp_login(phone): Complete login process
  • send_message(contact, message): Send WhatsApp message

Support

For issues and questions:

  1. Check the logs in ./logs/app.log
  2. Review screenshots in ./screenshots/
  3. Verify configuration in config.ini
  4. Ensure all prerequisites are installed

License

This project is for educational and testing purposes only. Ensure compliance with all applicable laws and terms of service.

About

Automated WhatsApp verification system using Android emulator and SIM gateway control for SMS-based authentication testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages