Skip to content

Instantly share code, notes, and snippets.

Created September 10, 2016 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/ed5695ccd5593443cd7c0dddaf7f9bf7 to your computer and use it in GitHub Desktop.
Save anonymous/ed5695ccd5593443cd7c0dddaf7f9bf7 to your computer and use it in GitHub Desktop.
Run multiple FOnline instances.
import psutil
import subprocess
import random
import string
import sys
from ctypes import *
from ctypes.wintypes import *
openProcess = windll.kernel32.OpenProcess
virtualProtectEx = windll.kernel32.VirtualProtectEx
writeProcessMemory = windll.kernel32.WriteProcessMemory
closeHandle = windll.kernel32.CloseHandle
getLastError = windll.kernel32.GetLastError
CREATE_SUSPENDED = 4
PROCESS_ALL_ACCESS = 0x1f0fff
PAGE_EXECUTE_READWRITE = 0x40
instanceStrAddress = 0x7433b4
syncStrAddress = 0x73bcdc
instanceStr = 'fonline_instance'
syncStr = '_fosync_'
def randomStr(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
def writeRandomStr(handle, originalStr, address):
str = randomStr(len(originalStr))
buffer = c_char_p(str)
bufferSize = len(buffer.value)
if not virtualProtectEx(handle, address, bufferSize, PAGE_EXECUTE_READWRITE, byref(c_ulong(0))):
print originalStr, " VirtualProtectEx failed: ", getLastError()
if not writeProcessMemory(handle, address, buffer, bufferSize, byref(c_ulong(0))):
print originalStr, " WriteProcessMemory failed: ", getLastError()
if len(sys.argv) != 2:
print ("Program accepts one parameter: FOnline executable path in quotes, "
"e. g. \"D:\FOnline2\FOnline 2.exe\"")
sys.exit()
path = sys.argv[1]
proc = subprocess.Popen(args=[path], creationflags=CREATE_SUSPENDED)
handle = openProcess(PROCESS_ALL_ACCESS, False, proc.pid)
writeRandomStr(handle, instanceStr, instanceStrAddress)
writeRandomStr(handle, syncStr, syncStrAddress)
closeHandle(handle)
psutil.Process(proc.pid).resume()
import psutil
import subprocess
import random
import string
import sys
from ctypes import *
from ctypes.wintypes import *
openProcess = windll.kernel32.OpenProcess
virtualProtectEx = windll.kernel32.VirtualProtectEx
writeProcessMemory = windll.kernel32.WriteProcessMemory
closeHandle = windll.kernel32.CloseHandle
getLastError = windll.kernel32.GetLastError
CREATE_SUSPENDED = 4
PROCESS_ALL_ACCESS = 0x1f0fff
PAGE_EXECUTE_READWRITE = 0x40
syncStrAddress = 0x7446c0
syncStr = '_fosync_'
def randomStr(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
def writeRandomStr(handle, originalStr, address):
str = randomStr(len(originalStr))
buffer = c_char_p(str)
bufferSize = len(buffer.value)
if not virtualProtectEx(handle, address, bufferSize, PAGE_EXECUTE_READWRITE, byref(c_ulong(0))):
print originalStr, " VirtualProtectEx failed: ", getLastError()
if not writeProcessMemory(handle, address, buffer, bufferSize, byref(c_ulong(0))):
print originalStr, " WriteProcessMemory failed: ", getLastError()
if len(sys.argv) != 2:
print ("Program accepts one parameter: FOnline executable path in quotes, "
"e. g. \"D:\FOnline Reloaded\FOnline.exe\"")
sys.exit()
path = sys.argv[1]
proc = subprocess.Popen(args=[path], creationflags=CREATE_SUSPENDED)
handle = openProcess(PROCESS_ALL_ACCESS, False, proc.pid)
writeRandomStr(handle, syncStr, syncStrAddress)
closeHandle(handle)
psutil.Process(proc.pid).resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment