forked from 1011025m/RobloxHomePatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobloxHomePatcher.py
61 lines (49 loc) · 1.8 KB
/
RobloxHomePatcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import re
import sys
import os
# The separation between the words are two null characters, in the var I just use two plus's to avoid confusion.
def toArbBytes(input):
list = ["\x00"+str.strip('+') for str in input]
return ''.join(list).encode()
def promptExit(code):
input("Press Enter to quit")
sys.exit(code)
bytesToFind = toArbBytes("InBrowser++InApp++RobloxGameUpdater")
bytesToReplace = toArbBytes("InBrowser++H4X3D++RobloxGameUpdater")
if len(bytesToFind) != len(bytesToReplace):
print("Target bytes do not match the length of replacement bytes!")
promptExit(1)
fileToPatch = None
robloxPath = os.getenv('LOCALAPPDATA') + '\Roblox\Versions'
folders = [folder for folder in os.listdir(robloxPath) if "version" in folder]
for folder in folders:
if 'RobloxPlayerLauncher.exe' in os.listdir(robloxPath+'\\'+folder):
print('Found executable!')
fileToPatch = robloxPath+'\\'+folder+'\\'+'RobloxPlayerLauncher.exe'
break
if fileToPatch is not None:
print(fileToPatch)
else:
print("Cannot find Roblox in your system. If you haven't installed it, please do so.")
promptExit(1)
try:
with open(fileToPatch, 'r+b') as topatch:
read = topatch.read()
regfind = re.search(bytesToFind, read)
if regfind is not None:
print("Found match!")
pos = regfind.start()
print(f'Position is: {str(pos)}')
print("Patching...", end=" ")
topatch.seek(pos)
topatch.write(bytesToReplace)
topatch.close()
print("Patched")
else:
print("Cannot find target bytes - maybe the executable has already been patched?")
promptExit(1)
except Exception as error:
print("An error occured:")
print(error)
promptExit(1)
promptExit(0)