-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
3,034 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.spec | ||
*.bat | ||
build/ | ||
dist/ | ||
__pycache__/ |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
import time | ||
from uuid import UUID | ||
from argparse import ArgumentParser | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser() | ||
parser.add_argument('--path', type=str, default='', help='client path') | ||
parser.add_argument('--patch', action='store_true', help='patch the client') | ||
parser.add_argument('--register', action='store_true', help='register the libraries') | ||
args = parser.parse_args() | ||
args.path = args.path.rstrip() | ||
if args.patch: | ||
uuid_pairs = [ | ||
[1, UUID('D27CDB6B-AE6D-11CF-96B8-444553540000'), UUID('682E7C31-6CE3-4FB3-9883-479ED34CB1B9')], # ShockwaveFlash TypeLib | ||
[1, UUID('D27CDB6C-AE6D-11CF-96B8-444553540000'), UUID('6B3DDCCB-B754-4D73-9E49-65B4AAD1EEAF')], # IShockwaveFlash | ||
[1, UUID('D27CDB6D-AE6D-11CF-96B8-444553540000'), UUID('543E9E91-C412-43DD-A12A-3F5AA34758D1')], # IShockwaveFlashEvents | ||
[1, UUID('D27CDB6E-AE6D-11CF-96B8-444553540000'), UUID('71E05279-CB7A-496A-8EE9-D700955CA40C')], # ShockwaveFlash CLSID | ||
[0, UUID('EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B'), UUID('E792F884-FF4C-4563-92FE-ADAEA759F2EA')], # WebBrowser TypeLib | ||
[0, UUID('EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B'), UUID('2170EFE4-F488-4F5C-A844-469080351EC4')], # IWebBrowser | ||
[0, UUID('0002DF05-0000-0000-C000-000000000046'), UUID('825FAF08-F4AF-46BE-8F65-4D6F73185E60')], # IWebBrowserApp | ||
[2, UUID('D30C1661-CDAF-11d0-8A3E-00C04FC9E26E'), UUID('65CD626F-FDC0-417C-BAAC-CC90E4FEBA16')], # IWebBrowser2 | ||
[0, UUID('EAB22AC2-30C1-11CF-A7EB-0000C05BAE0B'), UUID('DD68CD11-4932-435D-AE85-554A61B4D6F5')], # DWebBrowserEvents | ||
[1, UUID('34A715A0-6587-11D0-924A-0020AFC7AC4D'), UUID('A6601B01-4A9A-458A-A9D4-AA4207757056')], # DWebBrowserEvents2 | ||
[2, UUID('8856F961-340A-11D0-A96B-00C04FD705A2'), UUID('4D5AA1D8-B2D9-49D0-860E-8DAF2EC2CF0C')], # WebBrowser CLSID | ||
] | ||
with open(os.path.join(args.path, 'There.exe'), 'rb') as file: | ||
data = file.read() | ||
for uuid_pair in uuid_pairs: | ||
if data.find(uuid_pair[2].bytes_le) >= 0: | ||
print('The patch has already been applied.') | ||
time.sleep(5) | ||
sys.exit(1) | ||
for uuid_pair in uuid_pairs: | ||
index = 0 | ||
for i in range(uuid_pair[0]): | ||
f = data[index:].find(uuid_pair[1].bytes_le) | ||
if f < 0: | ||
print('The patch cannot be used with this version of There.') | ||
time.sleep(5) | ||
sys.exit(1) | ||
index += f | ||
data = data[:index] + uuid_pair[2].bytes_le + data[index + 16:] | ||
index += 1 | ||
if data[index:].find(uuid_pair[1].bytes_le) >= 0: | ||
print('The patch cannot be used with this version of There.') | ||
time.sleep(5) | ||
sys.exit(1) | ||
with open(os.path.join(args.path, 'ThereEdge.exe'), 'wb') as file: | ||
file.write(data) | ||
print('The patch was applied successfully.') | ||
if args.register: | ||
for name in ['BrowserProxy', 'FlashProxy']: | ||
if os.system('regsvr32 /s "%s.dll"' % os.path.join(args.path, name)) != 0: | ||
print('Registration of %s failed.' % name) | ||
time.sleep(5) | ||
sys.exit(1) | ||
sys.exit(0) |
Oops, something went wrong.