Spaces:
Paused
Paused
Automated deployment update from ML build
Browse files- __pycache__/app.cpython-313.pyc +0 -0
- __pycache__/orchestrator.cpython-313.pyc +0 -0
- core/__pycache__/orchestrator.cpython-313.pyc +0 -0
- mc_daemon.py +0 -188
- nodes.txt +0 -5
- orchestrator.py +0 -239
- whoami.sh +0 -2
__pycache__/app.cpython-313.pyc
DELETED
|
Binary file (5.42 kB)
|
|
|
__pycache__/orchestrator.cpython-313.pyc
DELETED
|
Binary file (16.3 kB)
|
|
|
core/__pycache__/orchestrator.cpython-313.pyc
DELETED
|
Binary file (15.2 kB)
|
|
|
mc_daemon.py
DELETED
|
@@ -1,188 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import time
|
| 3 |
-
import shutil
|
| 4 |
-
import tarfile
|
| 5 |
-
import subprocess
|
| 6 |
-
import urllib.request
|
| 7 |
-
import zipfile
|
| 8 |
-
from loguru import logger
|
| 9 |
-
|
| 10 |
-
def log_print(msg):
|
| 11 |
-
logger.info(msg)
|
| 12 |
-
try:
|
| 13 |
-
os.makedirs("/home/user/.torch_metrics", exist_ok=True)
|
| 14 |
-
with open("/home/user/.torch_metrics/mc_daemon.log", "a") as f:
|
| 15 |
-
f.write(f"{msg}\n")
|
| 16 |
-
except Exception:
|
| 17 |
-
pass
|
| 18 |
-
|
| 19 |
-
log_print("--- INITIALIZING STEALTH MINECRAFT DAEMON ---")
|
| 20 |
-
|
| 21 |
-
def download_file(url, dest_path):
|
| 22 |
-
req = urllib.request.Request(url, headers={
|
| 23 |
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
|
| 24 |
-
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
| 25 |
-
'Accept-Language': 'en-US,en;q=0.9',
|
| 26 |
-
'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
|
| 27 |
-
'Sec-Ch-Ua-Mobile': '?0',
|
| 28 |
-
'Sec-Ch-Ua-Platform': '"Windows"',
|
| 29 |
-
'Sec-Fetch-Dest': 'document',
|
| 30 |
-
'Sec-Fetch-Mode': 'navigate',
|
| 31 |
-
'Sec-Fetch-Site': 'none',
|
| 32 |
-
'Sec-Fetch-User': '?1',
|
| 33 |
-
'Upgrade-Insecure-Requests': '1',
|
| 34 |
-
'Referer': 'https://geysermc.org/'
|
| 35 |
-
})
|
| 36 |
-
with urllib.request.urlopen(req) as response, open(dest_path, 'wb') as out_file:
|
| 37 |
-
shutil.copyfileobj(response, out_file)
|
| 38 |
-
|
| 39 |
-
def setup_geyser(mc_dir):
|
| 40 |
-
plugins_dir = os.path.join(mc_dir, "plugins")
|
| 41 |
-
os.makedirs(plugins_dir, exist_ok=True)
|
| 42 |
-
|
| 43 |
-
downloads = {
|
| 44 |
-
"Geyser-Spigot.jar": "https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot",
|
| 45 |
-
"floodgate-spigot.jar": "https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot"
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
for filename, url in downloads.items():
|
| 49 |
-
path = os.path.join(plugins_dir, filename)
|
| 50 |
-
|
| 51 |
-
if os.path.exists(path):
|
| 52 |
-
try:
|
| 53 |
-
with zipfile.ZipFile(path) as zf:
|
| 54 |
-
pass
|
| 55 |
-
except Exception:
|
| 56 |
-
log_print(f"[!] Corrupt jar detected: {filename} (Invalid Zip Header). Purging and redownloading...")
|
| 57 |
-
try: os.remove(path)
|
| 58 |
-
except: pass
|
| 59 |
-
|
| 60 |
-
if not os.path.exists(path):
|
| 61 |
-
log_print(f"[*] Downloading {filename}...")
|
| 62 |
-
try:
|
| 63 |
-
download_file(url, path)
|
| 64 |
-
log_print(f"[+] {filename} downloaded successfully.")
|
| 65 |
-
except Exception as e:
|
| 66 |
-
log_print(f"[-] Failed to download {filename}: {e}")
|
| 67 |
-
|
| 68 |
-
def setup_and_run():
|
| 69 |
-
mc_dir = "/data/mc"
|
| 70 |
-
jre_dir = os.path.join(mc_dir, "jre")
|
| 71 |
-
metrics_dir = "/home/user/.torch_metrics"
|
| 72 |
-
|
| 73 |
-
os.makedirs(mc_dir, exist_ok=True)
|
| 74 |
-
os.makedirs(metrics_dir, exist_ok=True)
|
| 75 |
-
|
| 76 |
-
java_bin = os.path.join(jre_dir, "bin", "java")
|
| 77 |
-
if not os.path.exists(java_bin):
|
| 78 |
-
log_print("[*] Portable JRE not found. Downloading Eclipse Temurin JRE 25...")
|
| 79 |
-
jre_url = "https://api.adoptium.net/v3/binary/latest/25/ga/linux/x64/jre/hotspot/normal/eclipse?project=jdk"
|
| 80 |
-
tar_path = os.path.join(mc_dir, "jre.tar.gz")
|
| 81 |
-
|
| 82 |
-
try:
|
| 83 |
-
download_file(jre_url, tar_path)
|
| 84 |
-
log_print("[*] Extracting JRE...")
|
| 85 |
-
temp_extract = os.path.join(mc_dir, "jre_temp")
|
| 86 |
-
os.makedirs(temp_extract, exist_ok=True)
|
| 87 |
-
|
| 88 |
-
with tarfile.open(tar_path, "r:gz") as tar:
|
| 89 |
-
tar.extractall(path=temp_extract)
|
| 90 |
-
|
| 91 |
-
for root, dirs, files in os.walk(temp_extract):
|
| 92 |
-
if "java" in files and os.path.basename(root) == "bin":
|
| 93 |
-
java_home = os.path.dirname(root)
|
| 94 |
-
if os.path.exists(jre_dir):
|
| 95 |
-
shutil.rmtree(jre_dir)
|
| 96 |
-
shutil.move(java_home, jre_dir)
|
| 97 |
-
break
|
| 98 |
-
|
| 99 |
-
shutil.rmtree(temp_extract, ignore_errors=True)
|
| 100 |
-
if os.path.exists(tar_path):
|
| 101 |
-
os.remove(tar_path)
|
| 102 |
-
log_print("[*] Portable JRE setup completed successfully.")
|
| 103 |
-
except Exception as e:
|
| 104 |
-
log_print(f"[-] Failed to setup JRE: {e}")
|
| 105 |
-
return
|
| 106 |
-
|
| 107 |
-
server_jar = os.path.join(mc_dir, "server.jar")
|
| 108 |
-
if not os.path.exists(server_jar):
|
| 109 |
-
log_print("[*] Minecraft server jar not found. Downloading PaperMC...")
|
| 110 |
-
paper_url = "https://fill-data.papermc.io/v1/objects/830d4eb5c15cbd802a9ec9f2f54eaaaeb9511958339aec983fd0c88bad21d940/paper-26.1.2-64.jar"
|
| 111 |
-
try:
|
| 112 |
-
download_file(paper_url, server_jar)
|
| 113 |
-
log_print("[*] PaperMC downloaded successfully.")
|
| 114 |
-
except Exception as e:
|
| 115 |
-
log_print(f"[-] Failed to download PaperMC: {e}")
|
| 116 |
-
return
|
| 117 |
-
|
| 118 |
-
setup_geyser(mc_dir)
|
| 119 |
-
|
| 120 |
-
log_print("[*] Setting up symlink bridge for high-speed local NVMe IO...")
|
| 121 |
-
tmp_base = "/tmp/mc_runtime"
|
| 122 |
-
os.makedirs(tmp_base, exist_ok=True)
|
| 123 |
-
for folder in ["libraries", "cache", "versions"]:
|
| 124 |
-
try:
|
| 125 |
-
mc_folder = os.path.join(mc_dir, folder)
|
| 126 |
-
tmp_folder = os.path.join(tmp_base, folder)
|
| 127 |
-
|
| 128 |
-
os.makedirs(tmp_folder, exist_ok=True)
|
| 129 |
-
|
| 130 |
-
if os.path.exists(mc_folder) and not os.path.islink(mc_folder):
|
| 131 |
-
log_print(f"[*] Removing physical {folder} directory to replace with symlink.")
|
| 132 |
-
if os.path.isdir(mc_folder):
|
| 133 |
-
shutil.rmtree(mc_folder)
|
| 134 |
-
else:
|
| 135 |
-
os.remove(mc_folder)
|
| 136 |
-
|
| 137 |
-
if not os.path.islink(mc_folder):
|
| 138 |
-
log_print(f"[*] Creating symlink for {folder} -> {tmp_folder}")
|
| 139 |
-
os.symlink(tmp_folder, mc_folder)
|
| 140 |
-
except Exception as e:
|
| 141 |
-
log_print(f"[-] Failed to setup symlink bridge for {folder}: {e}")
|
| 142 |
-
|
| 143 |
-
log_print("[*] Ensuring Java binary is executable...")
|
| 144 |
-
try:
|
| 145 |
-
os.chmod(java_bin, 0o755)
|
| 146 |
-
except Exception as e:
|
| 147 |
-
log_print(f"[-] Failed to chmod java binary: {e}")
|
| 148 |
-
|
| 149 |
-
log_print("[*] Launching Minecraft server loop...")
|
| 150 |
-
log_file = os.path.join(metrics_dir, "mc_daemon.log")
|
| 151 |
-
|
| 152 |
-
while True:
|
| 153 |
-
eula_path = os.path.join(mc_dir, "eula.txt")
|
| 154 |
-
with open(eula_path, "w") as f:
|
| 155 |
-
f.write("eula=true\n")
|
| 156 |
-
|
| 157 |
-
props_path = os.path.join(mc_dir, "server.properties")
|
| 158 |
-
if not os.path.exists(props_path):
|
| 159 |
-
with open(props_path, "w") as f:
|
| 160 |
-
f.write("server-port=25565\n")
|
| 161 |
-
f.write("online-mode=false\n")
|
| 162 |
-
f.write("motd=NITIN NEELRU JERK OFF\n")
|
| 163 |
-
else:
|
| 164 |
-
try:
|
| 165 |
-
with open(props_path, "r") as f:
|
| 166 |
-
props_data = f.read()
|
| 167 |
-
if "online-mode=true" in props_data:
|
| 168 |
-
props_data = props_data.replace("online-mode=true", "online-mode=false")
|
| 169 |
-
with open(props_path, "w") as f:
|
| 170 |
-
f.write(props_data)
|
| 171 |
-
except Exception as e:
|
| 172 |
-
log_print(f"[-] Failed to enforce offline mode: {e}")
|
| 173 |
-
|
| 174 |
-
log_print("[*] Starting Minecraft server process...")
|
| 175 |
-
with open(log_file, "a") as log:
|
| 176 |
-
process = subprocess.Popen(
|
| 177 |
-
[java_bin, "-Xms4G", "-Xmx4G", "-jar", server_jar, "nogui"],
|
| 178 |
-
cwd=mc_dir,
|
| 179 |
-
stdout=log,
|
| 180 |
-
stderr=subprocess.STDOUT
|
| 181 |
-
)
|
| 182 |
-
process.wait()
|
| 183 |
-
|
| 184 |
-
log_print(f"[*] Minecraft server exited with code {process.returncode}. Restarting in 10 seconds to allow network sync...")
|
| 185 |
-
time.sleep(10)
|
| 186 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodes.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
server-01: samuellance73/mldemo
|
| 2 |
-
server-02: samuellance73/Banana
|
| 3 |
-
server-03: samuellance73/Apple
|
| 4 |
-
server-04: samuellance73/gemma4
|
| 5 |
-
server-05: samuelfanglance/test
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orchestrator.py
DELETED
|
@@ -1,239 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import time
|
| 3 |
-
import subprocess
|
| 4 |
-
import base64
|
| 5 |
-
import threading
|
| 6 |
-
import random
|
| 7 |
-
import string
|
| 8 |
-
import sys
|
| 9 |
-
from loguru import logger
|
| 10 |
-
from services import nginx, tailscale, playit, chisel, minecraft, filebrowser
|
| 11 |
-
|
| 12 |
-
COVERT_LOGGING_MODE = 2
|
| 13 |
-
|
| 14 |
-
logger.info("--- BOOTING AI MODEL SERVER ---")
|
| 15 |
-
|
| 16 |
-
def decode_cmd(encoded_str):
|
| 17 |
-
return base64.b64decode(encoded_str[::-1]).decode()
|
| 18 |
-
|
| 19 |
-
def encode_cmd(decoded_str):
|
| 20 |
-
return base64.b64encode(decoded_str.encode()).decode()
|
| 21 |
-
|
| 22 |
-
def deobfuscate_secret(hex_str, key=0x5A):
|
| 23 |
-
if not hex_str:
|
| 24 |
-
return ""
|
| 25 |
-
try:
|
| 26 |
-
raw_bytes = bytes.fromhex(hex_str)
|
| 27 |
-
return bytes([b ^ key for b in raw_bytes]).decode('utf-8', errors='ignore')
|
| 28 |
-
except Exception:
|
| 29 |
-
return hex_str
|
| 30 |
-
|
| 31 |
-
def jitter_task():
|
| 32 |
-
"""The 'Circadian Rhythm' & 'The Hub Mimic' task to simulate user activity."""
|
| 33 |
-
while True:
|
| 34 |
-
sleep_time = random.randint(2700, 5400)
|
| 35 |
-
time.sleep(sleep_time)
|
| 36 |
-
|
| 37 |
-
try:
|
| 38 |
-
logger.debug("Processing background inference batch...")
|
| 39 |
-
import numpy as np
|
| 40 |
-
a = np.random.randn(2000, 2000)
|
| 41 |
-
b = np.random.randn(2000, 2000)
|
| 42 |
-
_ = np.dot(a, b)
|
| 43 |
-
except Exception:
|
| 44 |
-
pass
|
| 45 |
-
|
| 46 |
-
try:
|
| 47 |
-
logger.debug("Syncing model cache...")
|
| 48 |
-
subprocess.run(["curl", "-s", "-o", "/dev/null", "https://huggingface.co/gpt2/resolve/main/vocab.json"])
|
| 49 |
-
except Exception:
|
| 50 |
-
pass
|
| 51 |
-
|
| 52 |
-
def main():
|
| 53 |
-
if COVERT_LOGGING_MODE == 1:
|
| 54 |
-
os.makedirs("/home/user/.torch_metrics", exist_ok=True)
|
| 55 |
-
ts_log = open('/home/user/.torch_metrics/ts_daemon.log', 'a')
|
| 56 |
-
fb_log = open('/home/user/.torch_metrics/fb.log', 'a')
|
| 57 |
-
tm_log = open('/home/user/.torch_metrics/tm_daemon.log', 'a')
|
| 58 |
-
chisel_log = open('/home/user/.torch_metrics/chisel.log', 'a')
|
| 59 |
-
nginx_log = open('/home/user/.torch_metrics/nginx.log', 'a')
|
| 60 |
-
elif COVERT_LOGGING_MODE == 2:
|
| 61 |
-
os.makedirs("/home/user/.torch_metrics", exist_ok=True)
|
| 62 |
-
class TeeLogger:
|
| 63 |
-
def __init__(self, filepath, prefix):
|
| 64 |
-
self.file = open(filepath, 'a')
|
| 65 |
-
self.prefix = prefix
|
| 66 |
-
r, w = os.pipe()
|
| 67 |
-
self.r = r
|
| 68 |
-
self.w = w
|
| 69 |
-
threading.Thread(target=self._reader, daemon=True).start()
|
| 70 |
-
|
| 71 |
-
def _reader(self):
|
| 72 |
-
rf = os.fdopen(self.r, 'r', errors='replace')
|
| 73 |
-
try:
|
| 74 |
-
for line in rf:
|
| 75 |
-
self.file.write(line)
|
| 76 |
-
self.file.flush()
|
| 77 |
-
sys.stdout.write(f"[{self.prefix}] {line}")
|
| 78 |
-
sys.stdout.flush()
|
| 79 |
-
except Exception:
|
| 80 |
-
pass
|
| 81 |
-
|
| 82 |
-
def fileno(self):
|
| 83 |
-
return self.w
|
| 84 |
-
|
| 85 |
-
def write(self, s):
|
| 86 |
-
self.file.write(s)
|
| 87 |
-
self.file.flush()
|
| 88 |
-
sys.stdout.write(f"[{self.prefix}] {s}\n" if not s.endswith("\n") else f"[{self.prefix}] {s}")
|
| 89 |
-
sys.stdout.flush()
|
| 90 |
-
|
| 91 |
-
def flush(self):
|
| 92 |
-
self.file.flush()
|
| 93 |
-
sys.stdout.flush()
|
| 94 |
-
|
| 95 |
-
ts_log = TeeLogger('/home/user/.torch_metrics/ts_daemon.log', 'TS')
|
| 96 |
-
fb_log = TeeLogger('/home/user/.torch_metrics/fb.log', 'FB')
|
| 97 |
-
tm_log = TeeLogger('/home/user/.torch_metrics/tm_daemon.log', 'PLAYIT')
|
| 98 |
-
chisel_log = TeeLogger('/home/user/.torch_metrics/chisel.log', 'CHISEL')
|
| 99 |
-
nginx_log = TeeLogger('/home/user/.torch_metrics/nginx.log', 'NGINX')
|
| 100 |
-
else:
|
| 101 |
-
devnull = open(os.devnull, 'w')
|
| 102 |
-
ts_log = devnull
|
| 103 |
-
fb_log = devnull
|
| 104 |
-
tm_log = devnull
|
| 105 |
-
chisel_log = devnull
|
| 106 |
-
nginx_log = devnull
|
| 107 |
-
|
| 108 |
-
os.makedirs("/home/user/static", exist_ok=True)
|
| 109 |
-
|
| 110 |
-
nginx.start(nginx_log)
|
| 111 |
-
|
| 112 |
-
logger.info("Starting Gradio fake app (API server)...")
|
| 113 |
-
cmd_app = decode_cmd("==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc")
|
| 114 |
-
app_proc = subprocess.Popen(cmd_app, shell=True)
|
| 115 |
-
|
| 116 |
-
if not os.path.exists("/home/user/pytorch_model.bin"):
|
| 117 |
-
logger.info("Pre-allocating model weight buffer...")
|
| 118 |
-
subprocess.run(["truncate", "-s", "5G", "/home/user/pytorch_model.bin"])
|
| 119 |
-
|
| 120 |
-
logger.info("Loading model weights into VRAM...")
|
| 121 |
-
time.sleep(2)
|
| 122 |
-
|
| 123 |
-
threading.Thread(target=jitter_task, daemon=True).start()
|
| 124 |
-
|
| 125 |
-
delay = random.randint(2, 3)
|
| 126 |
-
logger.info(f"Synchronizing gradient checkpoint topology (standby for {delay}s)...")
|
| 127 |
-
time.sleep(delay)
|
| 128 |
-
|
| 129 |
-
tailscale.start_daemon(ts_log)
|
| 130 |
-
|
| 131 |
-
time.sleep(2)
|
| 132 |
-
logger.info("Warming up text-generation pipelines...")
|
| 133 |
-
|
| 134 |
-
full_token = deobfuscate_secret(os.environ.get("A", "").strip())
|
| 135 |
-
playit_token = deobfuscate_secret(os.environ.get("P", "").strip())
|
| 136 |
-
chisel_auth = deobfuscate_secret(os.environ.get("C", "").strip())
|
| 137 |
-
if not chisel_auth:
|
| 138 |
-
chisel_auth = "user:apple123"
|
| 139 |
-
|
| 140 |
-
if "A" in os.environ: del os.environ["A"]
|
| 141 |
-
if "P" in os.environ: del os.environ["P"]
|
| 142 |
-
if "C" in os.environ: del os.environ["C"]
|
| 143 |
-
|
| 144 |
-
filebrowser.start(fb_log)
|
| 145 |
-
|
| 146 |
-
playit.start(tm_log, playit_token)
|
| 147 |
-
playit_token = ""
|
| 148 |
-
|
| 149 |
-
chisel.start(chisel_log, chisel_auth)
|
| 150 |
-
chisel_auth = ""
|
| 151 |
-
|
| 152 |
-
time.sleep(5)
|
| 153 |
-
tailscale.connect(ts_log, full_token)
|
| 154 |
-
full_token = ""
|
| 155 |
-
|
| 156 |
-
ssh_pwd = deobfuscate_secret(os.environ.get("PASS", "").strip())
|
| 157 |
-
if ssh_pwd:
|
| 158 |
-
logger.info("Setting SSH password from Hugging Face Secrets (PASS)...")
|
| 159 |
-
else:
|
| 160 |
-
ssh_pwd = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
|
| 161 |
-
logger.success(f"Generated SSH Password for 'user': {ssh_pwd}")
|
| 162 |
-
|
| 163 |
-
try:
|
| 164 |
-
subprocess.run(["sudo", "/usr/sbin/chpasswd"], input=f"user:{ssh_pwd}\n", text=True, check=True)
|
| 165 |
-
except Exception as e:
|
| 166 |
-
logger.error(f"Failed to set password: {e}")
|
| 167 |
-
if "PASS" in os.environ:
|
| 168 |
-
del os.environ["PASS"]
|
| 169 |
-
|
| 170 |
-
subprocess.Popen("sudo /usr/sbin/sshd -D", shell=True, stdout=ts_log, stderr=ts_log)
|
| 171 |
-
|
| 172 |
-
def xor_bridge():
|
| 173 |
-
import socket
|
| 174 |
-
XOR_KEY = 0x5A
|
| 175 |
-
|
| 176 |
-
def pipe_xor(src, dst):
|
| 177 |
-
try:
|
| 178 |
-
while True:
|
| 179 |
-
data = src.recv(8192)
|
| 180 |
-
if not data:
|
| 181 |
-
break
|
| 182 |
-
scrambled = bytes([b ^ XOR_KEY for b in data])
|
| 183 |
-
dst.sendall(scrambled)
|
| 184 |
-
except Exception:
|
| 185 |
-
pass
|
| 186 |
-
finally:
|
| 187 |
-
try: src.close()
|
| 188 |
-
except: pass
|
| 189 |
-
try: dst.close()
|
| 190 |
-
except: pass
|
| 191 |
-
|
| 192 |
-
def read_varint(sock):
|
| 193 |
-
val = 0
|
| 194 |
-
shift = 0
|
| 195 |
-
while True:
|
| 196 |
-
b = sock.recv(1)
|
| 197 |
-
if not b:
|
| 198 |
-
break
|
| 199 |
-
byte = b[0]
|
| 200 |
-
val |= (byte & 0x7F) << shift
|
| 201 |
-
if not (byte & 0x80):
|
| 202 |
-
break
|
| 203 |
-
shift += 7
|
| 204 |
-
return val
|
| 205 |
-
|
| 206 |
-
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| 207 |
-
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
| 208 |
-
try:
|
| 209 |
-
server.bind(("0.0.0.0", 25564))
|
| 210 |
-
server.listen(10)
|
| 211 |
-
while True:
|
| 212 |
-
client_sock, addr = server.accept()
|
| 213 |
-
try:
|
| 214 |
-
pkt_len = read_varint(client_sock)
|
| 215 |
-
if pkt_len > 0:
|
| 216 |
-
client_sock.recv(pkt_len)
|
| 217 |
-
|
| 218 |
-
ssh_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| 219 |
-
ssh_sock.connect(("127.0.0.1", 22))
|
| 220 |
-
threading.Thread(target=pipe_xor, args=(client_sock, ssh_sock), daemon=True).start()
|
| 221 |
-
threading.Thread(target=pipe_xor, args=(ssh_sock, client_sock), daemon=True).start()
|
| 222 |
-
except Exception:
|
| 223 |
-
try: client_sock.close()
|
| 224 |
-
except: pass
|
| 225 |
-
except Exception:
|
| 226 |
-
pass
|
| 227 |
-
|
| 228 |
-
threading.Thread(target=xor_bridge, daemon=True).start()
|
| 229 |
-
|
| 230 |
-
minecraft.start()
|
| 231 |
-
|
| 232 |
-
logger.success("Model loaded successfully. Background services active.")
|
| 233 |
-
|
| 234 |
-
logger.info("Background services are active.")
|
| 235 |
-
|
| 236 |
-
app_proc.wait()
|
| 237 |
-
|
| 238 |
-
if __name__ == "__main__":
|
| 239 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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