Last active
December 19, 2015 19:19
-
-
Save jwrb/6005266 to your computer and use it in GitHub Desktop.
Cubeworld IP Binder. Patch your CubeWorld Server executable and make it bind to just one IP!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' | |
CubeWorld Server IP + Port Patcher (Ports coming soon!) | |
By island219 | |
Version 1.0.1 | |
Developed for PlugPayPlay | |
''' | |
import os, sys, socket | |
def validateIP(ip): | |
try: | |
socket.inet_aton(ip) | |
return 0 | |
except socket.error: | |
return 1 | |
def convertIP(ip): | |
hexIP = socket.inet_aton(ip) | |
return hexIP | |
if not os.path.isfile("Server.exe"): | |
raise Exception("Couldn't find server binary!") | |
if os.path.isfile("Server_MITD.exe"): | |
raise Exception("Server_MITD.exe already exists, you have to remove it first.") | |
print 'Creating patched server binary..' | |
original = open('Server.exe', 'rb') | |
if __name__ == "__main__": | |
ip = sys.argv[1] | |
if validateIP(ip) == 0: | |
hexIP = convertIP(ip) | |
print 'IP is valid!' | |
else: | |
print "%s is Not a Vaild IP Address!" % ip | |
if original: | |
custom = open('Server_MITD.exe', 'wb') | |
edit = str(original.read()) | |
loc = edit.find('\x45\xE4\x00\x00\x00\x00\xE8\x11') | |
if not loc: | |
raise Exception("Server_MITD.exe seems to be already modified.") | |
custom.write(edit.replace('\x45\xE4\x00\x00\x00\x00\xE8\x11', '\x45\xE4' + hexIP + '\xE8\x11', 1)) | |
custom.close() | |
original.close() | |
print 'IP has been changed to ' + ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment