Skip to content

Instantly share code, notes, and snippets.

@mipek
Last active December 19, 2015 12:59
Show Gist options
  • Save mipek/5958498 to your computer and use it in GitHub Desktop.
Save mipek/5958498 to your computer and use it in GitHub Desktop.
CubeWorld Server Port Changer
#!/usr/bin/python
'''
CubeWorld Server Port Changer
By DonRevan
Version 1.0
'''
import os
if not os.path.isfile("Server.exe"):
raise Exception("Couldn't find server binary!")
if os.path.isfile("Server_MITM.exe"):
raise Exception("Server_MITM.exe already exists, you have to remove it first.")
print 'Creating patched server binary..'
original = open('Server.exe', 'rb')
if original:
custom = open('Server_MITM.exe', 'wb')
edit = str(original.read())
loc = edit.find('\x68\x39\x30\x00\x00')
if not loc:
raise Exception("Server_MITM.exe seems to be already modified.")
custom.write(edit.replace('\x68\x39\x30\x00\x00', '\x68\x3A\x30\x00\x00', 1))
custom.close()
original.close()
print 'Port has been changed!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment