-
-
Save cntrump/82afe236f900d6aec16efc41c57d3152 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3 | |
# -*- coding: UTF-8 -*- | |
import os | |
import sys | |
import platform | |
def useage(): | |
print("useage: bcompare_patch.py /path/to/BCompare") | |
def checkFileExists(path) -> bool: | |
if not os.path.exists(path): | |
print("File '%s' is not exists." % (path)) | |
return False | |
return True | |
def patchFile(path) -> bool: | |
try: | |
fd = open(path, 'rb') | |
data = fd.read() | |
fd.close() | |
except Exception as e: | |
print("Can't read '%s', error: %s" %(path, str(e))) | |
return False | |
n1 = b'keexjEP3t4Mue23hrnuPtY4TdcsqNiJL-5174TsUdLmJSIXKfG2NGPwBL6vnRPddT7tH29qpkneX63DO9ECSPE9rzY1zhThHERg8lHM9IBFT+rVuiY823aQJuqzxCKIE1bcDqM4wgW01FH6oCBP1G4ub01xmb4BGSUG6ZrjxWHJyNLyIlGvOhoY2HAYzEtzYGwxFZn2JZ66o4RONkXjX0DF9EzsdUef3UAS+JQ+fCYReLawdjEe6tXCv88GKaaPKWxCeaUL9PejICQgRQOLGOZtZQkLgAelrOtehxz5ANOOqCaJgy2mJLQVLM5SJ9Dli909c5ybvEhVmIC0dc9dWH+' | |
n2 = b'N9KmiLVlKMU7RJqnE+WXEEPI1SgglmfmLc1yVH7dqBb9ehOoKG9UE+HAE1YvH1XX2XVGeEqYUY-Tsk7YBTz0WpSpoYyPgx6Iki5KLtQ5G-aKP9eysnkuOAkrvHU8bLbGtZteGwJarev03PhfCioJL4OSqsmQGEvDbHFEbNl1qJtdwEriR+VNZts9vNNLk7UGfeNwIiqpxjk4Mn09nmSd8FhM4ifvcaIbNCRoMPGl6KU12iseSe+w+1kFsLhX+OhQM8WXcWV10cGqBzQE9OqOLUcg9n0krrR3KrohstS9smTwEx9olyLYppvC0p5i7dAx2deWvM1ZxKNs0BvcXGukR+' | |
data = data.replace(n1, n2) | |
try: | |
fd = open(path, 'wb') | |
fd.write(data) | |
fd.close() | |
except Exception as e: | |
print("Can't write '%s', error: %s" %(path, str(e))) | |
return False | |
return True | |
if __name__ == '__main__': | |
path = '' | |
if len(sys.argv) == 1: | |
currentPlatform = platform.system() | |
if currentPlatform == 'Darwin': | |
path = "/Applications/Beyond Compare.app/Contents/MacOS/BCompare" | |
elif currentPlatform == 'Windows': | |
path = "C:/Program Files/Beyond Compare 4/BCompare.exe" | |
elif currentPlatform == 'Linux': | |
path = "/usr/lib/beyondcompare/BCompare" | |
if not os.path.exists(path): | |
useage() | |
sys.exit(0) | |
if path == '': | |
path = sys.argv[1] | |
if not checkFileExists(path): | |
sys.exit(-1) | |
if patchFile(path): | |
print("'%s' Patched." %(path)) |
For macOS:
After patched, before running you need resign Beyond Compare.app
with self-signed cert named signature
first.
How to create a self-signed cert: code-signing.txt
codesign --deep --force -s "signature" /Applications/Beyond\ Compare.app
Thanks, Worked for me an MAC 10.15.7 With BCompare 4.4.2 (build 26348)
hi, it's break the cache?
Many thanks, it works on my
macOS 13.0.1 (22A400)
Beyond Compare 4, Version 4.4.6 (build 27483)
Many thanks, it works on my
macOS 13.0.1 (22A400) Beyond Compare 4, Version 4.4.6 (build 27483)
can you confirm, it's save session cache?
MacOS 12.6.5 (21G531)
Beyond Compare 4, Version 4.4.6 (build 27483)
Can't start app after patching
command codesign --deep --force -s "signature" /Applications/Beyond\ Compare.app
write to me signature: no identity found
MacOS 12.6.5 (21G531) Beyond Compare 4, Version 4.4.6 (build 27483) Can't start app after patching command
codesign --deep --force -s "signature" /Applications/Beyond\ Compare.app
write to mesignature: no identity found
dont' patch. just delete trial time periode, then back to 30 days again.
Register with key: