diff --git a/.env b/.env deleted file mode 100644 index cac39e3..0000000 --- a/.env +++ /dev/null @@ -1,17 +0,0 @@ -# Phone Configuration -PHONE_IP=10.0.0.193 -ADB_PORT=5555 -TERMUX_API_PORT=5001 - -# Flask Configuration -FLASK_ENV=development -SECRET_KEY=your-secret-key-here -DEFAULT_DELAY_SECONDS=3 - -# SMS Campaign coordinates -SEND_BUTTON_X=1300 -SEND_BUTTON_Y=2900 - -# Termux API Configuration -TERMUX_API_SECRET=termux-sms-campaign-2025 -PREFER_TERMUX_API=true \ No newline at end of file diff --git a/android/app.py.backup b/android/app.py.backup deleted file mode 100644 index 95dbae6..0000000 --- a/android/app.py.backup +++ /dev/null @@ -1,73 +0,0 @@ -from flask import Flask, jsonify, render_template_string -import subprocess -import json - -app = Flask(__name__) - -@app.route('/') -def index(): - return render_template_string(''' - - -
-Server IP: 10.0.0.193:5000
-Environment: Termux on Android
-{json.dumps(battery_data, indent=2)}
-
- """
- except Exception as e:
- return f"{str(e)}"
-
-@app.route('/notification')
-def notification():
- try:
- subprocess.run(['termux-notification', '--title', 'Flask Test', '--content', 'Hello from SMS Campaign Manager!'], capture_output=True, text=True)
- return f"""
- Check your Android notifications.
- - """ - except Exception as e: - return f"{str(e)}"
-
-if __name__ == '__main__':
- print("๐ Starting SMS Campaign Manager on Termux...")
- print("๐ฑ Device IP: 10.0.0.193")
- print("๐ Access from Ubuntu: http://10.0.0.193:5000")
- app.run(host='0.0.0.0', port=5000, debug=True)
diff --git a/android/termux-sms-api-server.py.backup b/android/termux-sms-api-server.py.backup
deleted file mode 100644
index 47d7a89..0000000
--- a/android/termux-sms-api-server.py.backup
+++ /dev/null
@@ -1,437 +0,0 @@
-#!/usr/bin/env python3
-"""
-Termux SMS API Server
-Bridges SMS Campaign Manager (Ubuntu) with Termux API (Android)
-
-This server runs on the Android device in Termux and provides REST API
-endpoints for the main SMS Campaign Manager to send messages using
-native Android SMS capabilities instead of ADB automation.
-"""
-
-from flask import Flask, request, jsonify
-import subprocess
-import json
-import time
-import logging
-import hmac
-import hashlib
-import os
-from datetime import datetime
-from typing import Dict, List, Optional, Any
-
-# Configure logging
-logging.basicConfig(
- level=logging.INFO,
- format='%(asctime)s - %(levelname)s - %(message)s',
- handlers=[
- logging.FileHandler('/data/data/com.termux/files/home/logs/sms-api.log'),
- logging.StreamHandler()
- ]
-)
-logger = logging.getLogger(__name__)
-
-app = Flask(__name__)
-
-# Configuration
-CONFIG = {
- 'SECRET_KEY': os.environ.get('SMS_API_SECRET', 'termux-sms-campaign-2025'),
- 'MAX_MESSAGE_LENGTH': 160,
- 'RATE_LIMIT_DELAY': 2.0, # Seconds between messages
- 'ALLOWED_COMMANDS': [
- 'termux-sms-send',
- 'termux-sms-list',
- 'termux-battery-status',
- 'termux-location',
- 'termux-notification'
- ]
-}
-
-class SMSApiServer:
- """Main SMS API server class"""
-
- def __init__(self):
- self.last_send_time = 0
- self.message_count = 0
- self.start_time = time.time()
-
- def authenticate_request(self, request_data: str, signature: str) -> bool:
- """Verify HMAC signature for request authentication"""
- try:
- expected_signature = hmac.new(
- CONFIG['SECRET_KEY'].encode(),
- request_data.encode(),
- hashlib.sha256
- ).hexdigest()
- return hmac.compare_digest(signature, expected_signature)
- except Exception as e:
- logger.error(f"Authentication error: {e}")
- return False
-
- def execute_termux_command(self, command: List[str]) -> Dict[str, Any]:
- """Execute Termux API command with error handling"""
- if not command or command[0] not in CONFIG['ALLOWED_COMMANDS']:
- return {'success': False, 'error': 'Command not allowed'}
-
- try:
- logger.info(f"Executing: {' '.join(command)}")
- result = subprocess.run(
- command,
- capture_output=True,
- text=True,
- timeout=30
- )
-
- return {
- 'success': result.returncode == 0,
- 'stdout': result.stdout.strip(),
- 'stderr': result.stderr.strip(),
- 'return_code': result.returncode
- }
- except subprocess.TimeoutExpired:
- return {'success': False, 'error': 'Command timeout'}
- except Exception as e:
- return {'success': False, 'error': str(e)}
-
- def rate_limit_check(self) -> bool:
- """Check if enough time has passed since last message"""
- current_time = time.time()
- if current_time - self.last_send_time < CONFIG['RATE_LIMIT_DELAY']:
- return False
- self.last_send_time = current_time
- return True
-
- def send_sms(self, phone: str, message: str) -> Dict[str, Any]:
- """Send SMS using Termux API"""
- # Input validation
- if not phone or not message:
- return {'success': False, 'error': 'Phone and message required'}
-
- if len(message) > CONFIG['MAX_MESSAGE_LENGTH']:
- return {'success': False, 'error': f'Message too long (max {CONFIG["MAX_MESSAGE_LENGTH"]} chars)'}
-
- # Rate limiting
- if not self.rate_limit_check():
- return {'success': False, 'error': 'Rate limit exceeded, please wait'}
-
- # Execute SMS send command
- command = ['termux-sms-send', '-n', phone, message]
- result = self.execute_termux_command(command)
-
- if result['success']:
- self.message_count += 1
- logger.info(f"SMS sent to {phone}: {message[:50]}...")
-
- # Send confirmation notification
- self.execute_termux_command([
- 'termux-notification',
- '--title', 'SMS Sent',
- '--content', f'Message sent to {phone}'
- ])
-
- return {
- 'success': result['success'],
- 'error': result.get('error') or result.get('stderr'),
- 'timestamp': datetime.now().isoformat(),
- 'phone': phone,
- 'message_length': len(message),
- 'total_sent': self.message_count
- }
-
-# Global server instance
-sms_server = SMSApiServer()
-
-# API Endpoints
-# Web interface route
-@app.route("/")
-def index():
- """Web interface for SMS API Server"""
- from flask import render_template_string
- return render_template_string("""
-
-
- Android Termux Interface
Device IP: {{ device_ip }}
-Port: 5001
-Environment: Termux on Android
-GET /health
Returns server status, uptime, and message statistics
-POST /api/sms/send
Send SMS messages with name substitution support
-GET /api/device/battery
Get real-time Android device battery information
-GET /api/device/location
Get GPS coordinates (with permissions)
-GET /api/device/info
System information and device details
-No conversations found
+Choose a conversation from the left to start messaging
+