This commit is contained in:
lx
2026-07-06 14:01:11 -04:00
commit c4f97d729d
16468 changed files with 935321 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
import os
import subprocess
import time
import socket
import logging
import psutil
import win32gui
import win32con
import time
from UDPProxy import UDPProxy
def IsPortInUse( port : int ) -> bool:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(0.1)
portInUseResult = s.connect_ex(('127.0.0.1', port)) == 0
return portInUseResult
class ClientController:
"""
Used for controlling servers which we host off patched clients instead of normal RCCService
"""
ExecutablePath = None
Port = None
Process = None
AttachedUDPProxy = None
JoinScriptUrl = None
StartTimeout = 40
def __init__(self, ExecutablePath : str, JoinscriptUrl : str = "", ExpectedPort : int = 53640, StartTimeout : int = 40):
if IsPortInUse(ExpectedPort):
raise Exception(f"Port {str(ExpectedPort)} is already in use")
self.ExecutablePath = ExecutablePath
self.Port = ExpectedPort
self.JoinScriptUrl = JoinscriptUrl
self.StartTimeout = StartTimeout
self.Start( timeout = StartTimeout )
def BindUDPProxy( self, proxyObj : UDPProxy ):
if self.AttachedUDPProxy is not None:
raise Exception("UDPProxy is already attached")
if proxyObj is None:
raise Exception("proxyObj is None")
self.AttachedUDPProxy = proxyObj
def Start(self, timeout : int = 40):
"""
Starts the client
"""
if self.Process is not None:
raise Exception("Process is already started")
if self.JoinScriptUrl is None:
raise Exception("JoinScriptUrl is None")
startupInfo = subprocess.STARTUPINFO()
startupInfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupInfo.wShowWindow = subprocess.SW_HIDE
self.Process = subprocess.Popen([self.ExecutablePath, "-t", "None", "-j", self.JoinScriptUrl, "-a", "http://www.syntax.eco/Login/Negotiate.ashx"], stdout = subprocess.PIPE, stderr = subprocess.PIPE, startupinfo = startupInfo)
time.sleep(7.5) # Client usually takes about 7.5 seconds to start up
startTime = time.time()
while True:
if time.time() - startTime > timeout:
raise Exception("Client failed to start in time")
if self.Process.poll() is not None:
raise Exception("Client process died")
try:
def EnumWindowsCallback( hwnd, lParam ):
if win32gui.GetWindowText(hwnd) == "ROBLOX":
win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)
lParam.append(hwnd)
return True
hwnds = []
win32gui.EnumWindows(EnumWindowsCallback, hwnds)
if len(hwnds) > 0:
break
except:
pass
time.sleep(0.1)
logging.info(f"Started client on port {str(self.Port)}")
def Kill(self):
"""
Kills the client
"""
if self.Process is None:
raise Exception("Process has not started")
self.Process.kill()
self.Process = None
if self.AttachedUDPProxy is not None:
self.AttachedUDPProxy.StopUDPProxy()
self.AttachedUDPProxy = None
def KillRCC(self):
return self.Kill()
def __del__(self):
if self.Process is not None:
self.Kill()
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings>
<ContentFolder>content</ContentFolder>
<BaseUrl>http://www.syntax.top</BaseUrl>
</Settings>
Binary file not shown.
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
<file name="msvcr90.dll" /> <file name="msvcp90.dll" /> <file name="msvcm90.dll" />
</assembly>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.MFC"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
<file name="mfc90.dll" /> <file name="mfcm90.dll" />
</assembly>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.OpenMP"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
<file name="vcomp90.dll" />
</assembly>
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More