Skip to content

Instantly share code, notes, and snippets.

@cntrump
Last active November 25, 2023 07:27
Show Gist options
  • Save cntrump/82afe236f900d6aec16efc41c57d3152 to your computer and use it in GitHub Desktop.
Save cntrump/82afe236f900d6aec16efc41c57d3152 to your computer and use it in GitHub Desktop.
Beyond Compare 4 Patcher
#!/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))
@mdestafadilah
Copy link

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?

https://gist.github.com/rise-worlds/5a5917780663aada8028f96b15057a67?permalink_comment_id=4516606#gistcomment-4516606

@chemist118
Copy link

chemist118 commented Jun 1, 2023

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

@mdestafadilah
Copy link

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

dont' patch. just delete trial time periode, then back to 30 days again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment