"""
@ Base: https://play.google.com/store/apps/details?id=ai.elin.app.android
@ Author: Shannz
@ Note: Signup script to register account in elinai.
"""
import requests
import uuid
import json
import sys
class Color:
GREEN = '\033[92m'
RED = '\033[91m'
YELLOW = '\033[93m'
CYAN = '\033[96m'
RESET = '\033[0m'
def generate_device_id():
return uuid.uuid4().hex[:16]
def register_user():
print(f"{Color.CYAN}=== ELIN AI REGISTRATION ==={Color.RESET}")
try:
email = input("Masukkan Email ( terserah ngasal boleh ) : ").strip()
password = input("Masukkan Password : ").strip()
except KeyboardInterrupt:
print("\nOperasi dibatalkan.")
sys.exit()
if not email or not password:
print(f"{Color.RED}[!] Email dan Password tidak boleh kosong.{Color.RESET}")
return
url = "https://api.elin.ai/api/v1/users/register"
device_id = generate_device_id()
headers = {
'User-Agent': 'Elin AI/2.8.0 (ai.elin.app.android; build:220; Android 15; Model:25028RN03A)',
'Accept': 'application/json',
'Accept-Encoding': 'gzip',
'Content-Type': 'application/json',
'x-device-id': device_id,
'accept-language': 'en',
'x-timezone': 'Asia/Jakarta',
'accept-charset': 'UTF-8'
}
payload = {
"email": email,
"password": password
}
print(f"\n{Color.YELLOW}[...] Mendaftarkan akun...{Color.RESET}")
try:
response = requests.post(url, json=payload, headers=headers, timeout=10)
if response.status_code in [200, 201]:
data = response.json()
if data.get("is_active") is True:
print(f"\n{Color.GREEN}[SUCCESS] Registrasi Berhasil!{Color.RESET}")
print(f"ID User : {data.get('id')}")
print(f"Email : {data.get('email')}")
print(f"Created At : {data.get('created')}")
print(f"Device ID : {device_id}")
else:
print(f"\n{Color.RED}[FAILED] Akun dibuat tapi status tidak aktif.{Color.RESET}")
print(f"Respon: {json.dumps(data, indent=2)}")
else:
print(f"\n{Color.RED}[ERROR] Gagal Mendaftar (Status: {response.status_code}){Color.RESET}")
try:
err_data = response.json()
print(f"Pesan Server : {err_data.get('detail', err_data)}")
except:
print(f"Raw Response : {response.text}")
except requests.exceptions.RequestException as e:
print(f"\n{Color.RED}[Network Error] Terjadi kesalahan koneksi: {e}{Color.RESET}")
if __name__ == "__main__":
register_user()