File size: 2,062 Bytes
b6b6322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f2328f
b6b6322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
import time
import json
import urllib.request

# =========================
# INSTALL SSH
# =========================
os.system("apt update -y")
os.system("apt install -y openssh-server unzip curl wget")

# =========================
# SET PASSWORD ROOT
# =========================
os.system("echo 'root:123456' | chpasswd")

# =========================
# KONFIGURASI SSH
# =========================
os.system("sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config")
os.system("sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config")

# =========================
# START SSH
# =========================
os.system("service ssh restart")

# =========================
# INSTALL NGROK
# =========================
os.system("wget -q -O ngrok.zip https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip")
os.system("unzip -o ngrok.zip")
os.system("chmod +x ngrok")

# =========================
# MASUKKAN TOKEN NGROK
# =========================
NGROK_TOKEN = "3C0LPg1zjf8Ui52LQnfPnD8RYAp_Y8Ps2ghwf2yCNvhL7vit"
os.system(f"./ngrok config add-authtoken {NGROK_TOKEN}")

# =========================
# JALANKAN NGROK
# =========================
os.system("./ngrok tcp 22 > /dev/null 2>&1 &")

print("⏳ Menunggu ngrok... (10 detik)")
time.sleep(10)

# =========================
# AMBIL LINK NGROK
# =========================
try:
    with urllib.request.urlopen("http://127.0.0.1:4040/api/tunnels") as response:
        data = json.loads(response.read())
        public_url = data['tunnels'][0]['public_url']
        print("\n==============================")
        print("🔥 SSH AKTIF 🔥")
        print("Host:", public_url.replace("tcp://", "").split(":")[0])
        print("Port:", public_url.split(":")[-1])
        print("User: root")
        print("Pass: 123456")
        print("==============================\n")
except:
    print("❌ Gagal ambil URL ngrok")

# =========================
# LOOP AGAR TIDAK MATI
# =========================
while True:
    time.sleep(60)