Update app.py
Browse files
app.py
CHANGED
|
@@ -11,11 +11,12 @@ import os
|
|
| 11 |
import uuid
|
| 12 |
import sys
|
| 13 |
import builtins
|
|
|
|
| 14 |
|
| 15 |
# Force print to flush immediately
|
| 16 |
print = lambda *args, **kwargs: builtins.print(*args, **kwargs, flush=True)
|
| 17 |
|
| 18 |
-
BASE = "
|
| 19 |
LOGIN_URL = f"{BASE}/login"
|
| 20 |
GET_RANGE_URL = f"{BASE}/portal/sms/received/getsms"
|
| 21 |
GET_NUMBER_URL = f"{BASE}/portal/sms/received/getsms/number"
|
|
@@ -23,6 +24,7 @@ GET_SMS_URL = f"{BASE}/portal/sms/received/getsms/number/sms"
|
|
| 23 |
|
| 24 |
TELEGRAM_PROXY_URL = "https://danihitambangetjir.termai.cc/api/proxy"
|
| 25 |
CUSTOM_DOMAIN = "https://fourstore-otp.hf.space"
|
|
|
|
| 26 |
ACCOUNTS_FILE = "accounts.json"
|
| 27 |
|
| 28 |
def mask_email(email):
|
|
@@ -83,6 +85,27 @@ def get_search_date():
|
|
| 83 |
wib = get_wib_time()
|
| 84 |
return (wib - timedelta(days=1)).strftime("%Y-%m-%d") if wib.hour < 7 else wib.strftime("%Y-%m-%d")
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
def login_account(account_id, username, password, bot_token, chat_id):
|
| 87 |
try:
|
| 88 |
masked_username = mask_email(username)
|
|
@@ -92,6 +115,7 @@ def login_account(account_id, username, password, bot_token, chat_id):
|
|
| 92 |
|
| 93 |
session = httpx.Client(follow_redirects=True, timeout=30.0)
|
| 94 |
|
|
|
|
| 95 |
r = session.get(LOGIN_URL, timeout=30)
|
| 96 |
if r.status_code != 200:
|
| 97 |
return False, f"HTTP {r.status_code}"
|
|
@@ -102,13 +126,36 @@ def login_account(account_id, username, password, bot_token, chat_id):
|
|
| 102 |
return False, "Token tidak ditemukan"
|
| 103 |
|
| 104 |
csrf_token = token.get("value")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
|
|
|
| 107 |
"_token": csrf_token,
|
| 108 |
"email": username,
|
| 109 |
-
"password": password
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
|
|
|
| 112 |
if "dashboard" in r.text.lower() or "logout" in r.text.lower():
|
| 113 |
accounts[account_id]["session"] = session
|
| 114 |
accounts[account_id]["csrf"] = csrf_token
|
|
@@ -119,9 +166,17 @@ def login_account(account_id, username, password, bot_token, chat_id):
|
|
| 119 |
accounts[account_id]["chat_id"] = chat_id
|
| 120 |
accounts[account_id]["last_login"] = time.time()
|
| 121 |
save_accounts(accounts)
|
|
|
|
| 122 |
return True, "Login berhasil"
|
| 123 |
else:
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
except Exception as e:
|
| 127 |
return False, str(e)
|
|
@@ -1284,14 +1339,15 @@ Thread(target=run_server, daemon=True).start()
|
|
| 1284 |
|
| 1285 |
def main():
|
| 1286 |
print("\n" + "="*60)
|
| 1287 |
-
print(" 🔥 OTP MULTI ACCOUNT - FOURSTORE (
|
| 1288 |
print(" ⚡ PORT: 7860")
|
| 1289 |
print(f" 🌐 DOMAIN: {CUSTOM_DOMAIN}")
|
| 1290 |
print(" 📁 Data tersimpan di accounts.json")
|
| 1291 |
print(" 📧 Email akan disensor otomatis")
|
| 1292 |
print(" 🕐 Menggunakan WIB dengan logic sebelum jam 7")
|
| 1293 |
print(" 🔄 Auto-login saat run & saat tambah akun")
|
| 1294 |
-
print("
|
|
|
|
| 1295 |
print("="*60 + "\n")
|
| 1296 |
|
| 1297 |
# Login otomatis untuk akun yang sudah login sebelumnya
|
|
|
|
| 11 |
import uuid
|
| 12 |
import sys
|
| 13 |
import builtins
|
| 14 |
+
import asyncio
|
| 15 |
|
| 16 |
# Force print to flush immediately
|
| 17 |
print = lambda *args, **kwargs: builtins.print(*args, **kwargs, flush=True)
|
| 18 |
|
| 19 |
+
BASE = "https://www.ivasms.com"
|
| 20 |
LOGIN_URL = f"{BASE}/login"
|
| 21 |
GET_RANGE_URL = f"{BASE}/portal/sms/received/getsms"
|
| 22 |
GET_NUMBER_URL = f"{BASE}/portal/sms/received/getsms/number"
|
|
|
|
| 24 |
|
| 25 |
TELEGRAM_PROXY_URL = "https://danihitambangetjir.termai.cc/api/proxy"
|
| 26 |
CUSTOM_DOMAIN = "https://fourstore-otp.hf.space"
|
| 27 |
+
TURNSTILE_API = "https://fourstore-cf.hf.space/cloudflare"
|
| 28 |
ACCOUNTS_FILE = "accounts.json"
|
| 29 |
|
| 30 |
def mask_email(email):
|
|
|
|
| 85 |
wib = get_wib_time()
|
| 86 |
return (wib - timedelta(days=1)).strftime("%Y-%m-%d") if wib.hour < 7 else wib.strftime("%Y-%m-%d")
|
| 87 |
|
| 88 |
+
def get_turnstile_token():
|
| 89 |
+
"""Mendapatkan token Turnstile dari API"""
|
| 90 |
+
try:
|
| 91 |
+
resp = httpx.post(TURNSTILE_API, json={
|
| 92 |
+
"domain": "https://www.ivasms.com/login",
|
| 93 |
+
"siteKey": "0x4AAAAAACqVmW6ncA-jc10z",
|
| 94 |
+
"mode": "turnstile",
|
| 95 |
+
}, timeout=30)
|
| 96 |
+
|
| 97 |
+
if resp.status_code == 200:
|
| 98 |
+
data = resp.json()
|
| 99 |
+
token = data.get('token')
|
| 100 |
+
if token:
|
| 101 |
+
print(f" ✅ Turnstile token didapat")
|
| 102 |
+
return token
|
| 103 |
+
print(f" ❌ Gagal dapat token: {resp.text[:100]}")
|
| 104 |
+
return None
|
| 105 |
+
except Exception as e:
|
| 106 |
+
print(f" ❌ Error Turnstile: {e}")
|
| 107 |
+
return None
|
| 108 |
+
|
| 109 |
def login_account(account_id, username, password, bot_token, chat_id):
|
| 110 |
try:
|
| 111 |
masked_username = mask_email(username)
|
|
|
|
| 115 |
|
| 116 |
session = httpx.Client(follow_redirects=True, timeout=30.0)
|
| 117 |
|
| 118 |
+
# Ambil halaman login untuk mendapatkan _token
|
| 119 |
r = session.get(LOGIN_URL, timeout=30)
|
| 120 |
if r.status_code != 200:
|
| 121 |
return False, f"HTTP {r.status_code}"
|
|
|
|
| 126 |
return False, "Token tidak ditemukan"
|
| 127 |
|
| 128 |
csrf_token = token.get("value")
|
| 129 |
+
print(f" ✅ CSRF Token: {csrf_token[:20]}...")
|
| 130 |
+
|
| 131 |
+
# Dapatkan Turnstile token
|
| 132 |
+
turnstile_token = get_turnstile_token()
|
| 133 |
+
if not turnstile_token:
|
| 134 |
+
return False, "Gagal mendapatkan Turnstile token"
|
| 135 |
|
| 136 |
+
# Login dengan Turnstile token
|
| 137 |
+
login_data = {
|
| 138 |
"_token": csrf_token,
|
| 139 |
"email": username,
|
| 140 |
+
"password": password,
|
| 141 |
+
"remember": "on",
|
| 142 |
+
"cf-turnstile-response": turnstile_token,
|
| 143 |
+
"submit": "register"
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
# Headers seperti request asli
|
| 147 |
+
headers = {
|
| 148 |
+
"User-Agent": "Mozilla/5.0 (Linux; Android 14; CPH2641 Build/UP1A.231005.007) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.7632.159 Mobile Safari/537.36",
|
| 149 |
+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
| 150 |
+
"Accept-Language": "id-ID,id;q=0.9,en-ID;q=0.8,en-US;q=0.7,en;q=0.6",
|
| 151 |
+
"Origin": BASE,
|
| 152 |
+
"Referer": LOGIN_URL,
|
| 153 |
+
"Content-Type": "application/x-www-form-urlencoded"
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
r = session.post(LOGIN_URL, data=login_data, headers=headers, timeout=30)
|
| 157 |
|
| 158 |
+
# Cek apakah login berhasil
|
| 159 |
if "dashboard" in r.text.lower() or "logout" in r.text.lower():
|
| 160 |
accounts[account_id]["session"] = session
|
| 161 |
accounts[account_id]["csrf"] = csrf_token
|
|
|
|
| 166 |
accounts[account_id]["chat_id"] = chat_id
|
| 167 |
accounts[account_id]["last_login"] = time.time()
|
| 168 |
save_accounts(accounts)
|
| 169 |
+
print(f" ✅ Login berhasil untuk {masked_username}")
|
| 170 |
return True, "Login berhasil"
|
| 171 |
else:
|
| 172 |
+
# Cek pesan error
|
| 173 |
+
soup = BeautifulSoup(r.text, "html.parser")
|
| 174 |
+
error_div = soup.find("div", class_="alert alert-danger")
|
| 175 |
+
if error_div:
|
| 176 |
+
error_msg = error_div.get_text(strip=True)
|
| 177 |
+
else:
|
| 178 |
+
error_msg = "Login gagal - cek username/password"
|
| 179 |
+
return False, error_msg
|
| 180 |
|
| 181 |
except Exception as e:
|
| 182 |
return False, str(e)
|
|
|
|
| 1339 |
|
| 1340 |
def main():
|
| 1341 |
print("\n" + "="*60)
|
| 1342 |
+
print(" 🔥 OTP MULTI ACCOUNT - FOURSTORE (IVASMS VERSION)")
|
| 1343 |
print(" ⚡ PORT: 7860")
|
| 1344 |
print(f" 🌐 DOMAIN: {CUSTOM_DOMAIN}")
|
| 1345 |
print(" 📁 Data tersimpan di accounts.json")
|
| 1346 |
print(" 📧 Email akan disensor otomatis")
|
| 1347 |
print(" 🕐 Menggunakan WIB dengan logic sebelum jam 7")
|
| 1348 |
print(" 🔄 Auto-login saat run & saat tambah akun")
|
| 1349 |
+
print(" 🛡️ Turnstile token via API")
|
| 1350 |
+
print(" ✅ Target: IVASMS.com")
|
| 1351 |
print("="*60 + "\n")
|
| 1352 |
|
| 1353 |
# Login otomatis untuk akun yang sudah login sebelumnya
|