#!/usr/bin/env python3
import sys
import subprocess
import time

try:
    import pyotp
except ImportError:
    print("📦 Installing pyotp...")
    subprocess.check_call([sys.executable, "-m", "pip", "install", "pyotp"])
    import pyotp

# Your Secret Key
SECRET = 'DBBZI4HBMEN46KBJ4DJRJMFW'

def get_code():
    totp = pyotp.TOTP(SECRET)
    code = totp.now()
    time_remaining = totp.interval - (time.time() % totp.interval)
    
    print("\n🔐 FRESH 2FA CODE GENERATED")
    print("===========================")
    print(f"Code:   \033[1;32m{code}\033[0m")
    print(f"Valid:  {time_remaining:.1f} seconds")
    print("===========================")
    print("1. Clear Backup Code field (Leave EMPTY)")
    print(f"2. Paste ONLY: {code}")
    print("3. Click Save")

if __name__ == "__main__":
    get_code()
