Coder Social home page Coder Social logo

sublime-text-4-patcher's Introduction

sublime-text-4-patcher

Python 3 patcher for Sublime Text v4107-4169 Windows x64

Credits for most signatures and patching logic goes to https://github.com/leogx9r

  • Uses signatures instead of hardcoded offsets
  • Automatic version detection for stable/dev channels
  • No host blocking needed
  • Enter any text as license
  • Disables crash report telemetry
  • Disables phoning home
  • Minimal dependencies
  • Single Python file for convenience

Requirements

pip3 install -r requirements.txt

or just

pip3 install pefile

It's just for pefile which is indirectly used for version detection.

Usage

You only need sublime_text_4_patcher.py from this repository (and the aforementioned requirements).

IMPORTANT: Remember to enter any text as the license key after patching! For stable versions, you can accomplish this by going to Help > Enter License.

Input Prompt Mode

python3 sublime_text_4_patcher.py

You will then be prompted in the console to enter the file path to sublime_text.exe.

Command-Line Mode

python3 sublime_text_4_patcher.py <path_to_sublime_text.exe>

Test Mode

python3 sublime_text_4_patcher.py -t <directory_with_sublime_text_build_*_x64.zips>

The script will extract sublime_text.exe from each ZIP file into its own folder and try to patch it. Results are collated and logged to console.

Help

C:\>py sublime_text_4_patcher.py -h
usage: sublime_text_4_patcher.py [-h] [-t DIRPATH] [-f {stable,dev}] [filepath]

Sublime Text v4107-4164 Windows x64 Patcher by rainbowpigeon

positional arguments:
  filepath              File path to sublime_text.exe

options:
  -h, --help            show this help message and exit
  -t DIRPATH, --test DIRPATH
                        Directory path containing sublime_text_build_*_x64.zip files for batch testing
  -f {stable,dev}, --force {stable,dev}
                        Force patching even if detected Sublime Text version does not exist in the patch database

Report any issues at github.com/rainbowpigeon/sublime-text-4-patcher/issues!

Screenshots

Script execution in input prompt mode

Test Mode Results

Script results in test mode

sublime-text-4-patcher's People

Contributors

rainbowpigeon avatar themythologist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublime-text-4-patcher's Issues

No module named 'prefile'

I got the following error

Traceback (most recent call last):
File "sublime_text_4_patcher.py", line 8, in
import prefile
ModuleNotFoundError: No module named 'prefile'

Although I followed all the instructions and it even says when I try to reinstall prefile

Requirement already satisfied: pefile in c:\users\no name\appdata\local\programs\python\python37\lib\site-packages (2021.5.24)
Requirement already satisfied: future in c:\users\no name\appdata\local\programs\python\python37\lib\site-packages (from pefile) (0.18.2)

Is there a solution?

Not working for Build 4126

Thank you so much for writing this up, both as a crack but also for someone interested in furthering my Python knowledge, reading the source-code for this has been a good learning experience.

Unfortunately the patcher doesn't seem to be working for me for Sublime Text 4 Stable Build 4126. I'm copying the .exe from my Program Files into the patcher folder and patching directly from there to avoid permissions issues, but trying to enter a license gives me this error:

image

Here's my console output:

**PATH**\sublime-text-4-patcher (main -> origin)
λ python sublime_text_4_patcher.py
----------------------------------------------------------------
Sublime Text v4107-4126 Windows x64 Patcher by rainbowpigeon
----------------------------------------------------------------
Enter file path to sublime_text.exe: sublime_text.exe
[=] Processing ref for sig 48 8D 05 ? ? ? ? 48 8D 95 ? ? ? ? 48 89 02 48 8D 05 ? ? ? ? 48 89 42 08 48 8D 4D ? E8 ? ? ? ? B9...
[=] Found lea: \x48\x8d\x05\xe4\x48\x75\x00\x48\x8d\x95\x58\x02\x00\x00\x48\x89\x02\x48\x8d\x05\xd7\x48\x75\x00\x48\x89\x42\x08\x48\x8d\x4d\xb0\xe8\x28\x03\x00\x00\xb9
[=] Found relative address: 0x7548e4
[=] Determined actual offset: 0x759432
[+] Sublime Text Version 4126 detected
[=] Processing ref for sig 4C 8D 4D ? E8 ? ? ? ? ? 8B ? ? ? ? ? 85 C0...
[=] Found call: \x4c\x8d\x4d\x54\xe8\x0b\xe2\xff\xff\x49\x8b\x8e\x68\x02\x00\x00\x85\xc0
[=] Found relative address: 0xffffe20b
[=] Determined actual offset: 0xa7214
[+] Applying all patches...
[=] Offset 0x711a  : patching \xe8\xe1\x36\x20\x00 with \x90\x90\x90\x90\x90
[=] Offset 0x7133  : patching \xe8\xc8\x36\x20\x00 with \x90\x90\x90\x90\x90
[=] Offset 0xa7214 : patching \x55\x41\x57\x41 with \x48\x31\xc0\xc3
[=] Offset 0xa8d53 : patching \x55\x56\x57\x48\x83\xec\x30 with \x48\x31\xc0\x48\xff\xc0\xc3
[=] Offset 0xa6e0f : patching \x55\x56\x57\x48 with \x48\x31\xc0\xc3
[=] Offset 0x400   : patching \x41 with \xc3
[+] All patches applied!
[+] Backing up original file at sublime_text.exe.bak
[+] Patched file written at sublime_text.exe
Enjoy! :)
----------------------------------------------------------------
Report any issues at github.com/rainbowpigeon/sublime-text-4-patcher/issues!
----------------------------------------------------------------

I've cloned this repo directly and I'm running Python 3. Any help you could offer would be greatly appreciated thanks!

Sublime wants internet access right after fresh install + patch

Right after entering any license the "Thanks for purchase" popup appears and it wants internet access.
image
Port 443 so it is most likely https.
After running strings I found that it is either sublimehq.com, sublimetext.com or sublimemerge.com all pointing to this IP.
Or a crafted string from an array.
It might have been an initial version check, Im too lazy to open up wireshark tho. I just block it and we good.
If you want to find out you could use dnsproxy with --verbose to see all dns requests.

Crashing at enter filepath

I may be missing something, but after entering the file path the terminal window closes and does nothing. Sublime build 4126

Feature Request: Sublime Merge support

They're near identical patchers anyway, just different offsets, so it would be easy to add to this
pwsh scripts I use to patch:
ST

if (!(Get-FileHash sublime_text.exe -Algorithm MD5).Hash -eq '654F4259E066F90F4964E695CF808AD0') { exit }
'crash_reporter.exe', 'update_installer.exe' | ForEach-Object { if (Test-Path $_) { Remove-Item $_ } }
'000A9864: 48 31 C0 C3'          | xxd -r - sublime_text.exe
'000071FE: 90 90 90 90 90'       | xxd -r - sublime_text.exe
'00007217: 90 90 90 90 90'       | xxd -r - sublime_text.exe
'000AB682: 48 31 C0 48 FF C0 C3' | xxd -r - sublime_text.exe
'000A940F: C3'                   | xxd -r - sublime_text.exe
'00000400: C3'                   | xxd -r - sublime_text.exe

SM

if (!(Get-FileHash sublime_merge.exe -Algorithm MD5).Hash -eq 'CC38B7E3DAB6420773962F2C18929669') { exit }
'crash_reporter.exe', 'update_installer.exe' | ForEach-Object { if (Test-Path $_) { Remove-Item $_ } }
'000254FA: 48 31 C0 C3'             | xxd -r - sublime_merge.exe
'000289C9: 90 90 90 90 90'          | xxd -r - sublime_merge.exe
'000289E2: 90 90 90 90 90'          | xxd -r - sublime_merge.exe
'00026D59: 48 31 C0 48 FF C0 C3'    | xxd -r - sublime_merge.exe
'000250FD: C3'                      | xxd -r - sublime_merge.exe
'000241A4: C3'                      | xxd -r - sublime_merge.exe

0x000A65C7

Why you patch 0x000A65C7 with 48 31 C0 C3 for windows ? shouldn't it only be patched with C3 ?

PermissionError

Hello developer,

I get the error message when executing the py-file:
PermissionError: [Errno 13] Permission denied: 'C:\Users\UpdateFreak\Downloads'

The sublime_text_4_patcher.py and sublime_text.exe are in C:\Users\UpdateFreak\Downloads

System:
Windows 10 21H1 with Miniconda 3 (Python 3.9.5)

Build 4126 patcher not working

OS: Windows 8.1 Pro 64-Bit.

My console;

C:\Program Files\Sublime Text 3>py -3 sublime_text_4_patcher.py
----------------------------------------------------------------
Sublime Text v4107-4138 Windows x64 Patcher by rainbowpigeon
----------------------------------------------------------------
Enter file path to sublime_text.exe: sublime_text.exe
[=] Processing ref for sig 48 8D 05 ? ? ? ? 48 8D 95 ? ? ? ? 48 89 02 48 8D 05 ? ? ? ? 48 89 42 08 48 8D 4D ? E8 ? ? ? ? B9...
[=] Found lea: \x48\x8d\x05\xe4\x48\x75\x00\x48\x8d\x95\x58\x02\x00\x00\x48\x89\x02\x48\x8d\x05\xd7\x48\x75\x00\x48\x89\x42\x08\x48\x8d\x4d\xb0\xe8\x28\x03\x00\x00\xb9
[=] Found relative address: 0x7548e4
[=] Determined actual offset: 0x759432
[+] Sublime Text Version 4126 detected
[=] Processing ref for sig 4C 8D 4D ? E8 ? ? ? ? ? 8B ? ? ? ? ? 85 C0...
[=] Found call: \x4c\x8d\x4d\x54\xe8\x0b\xe2\xff\xff\x49\x8b\x8e\x68\x02\x00\x00\x85\xc0
[=] Found relative address: 0xffffe20b
[=] Determined actual offset: 0xa7214
[+] Applying all patches...
[=] Offset 0x711a  : patching \xe8\xe1\x36\x20\x00 with \x90\x90\x90\x90\x90
[=] Offset 0x7133  : patching \xe8\xc8\x36\x20\x00 with \x90\x90\x90\x90\x90
[=] Offset 0xa7214 : patching \x55\x41\x57\x41 with \x48\x31\xc0\xc3
[=] Offset 0xa8d53 : patching \x55\x56\x57\x48\x83\xec\x30 with \x48\x31\xc0\x48\xff\xc0\xc3
[=] Offset 0xa6e0f : patching \x55\x56\x57\x48 with \x48\x31\xc0\xc3
[=] Offset 0x400   : patching \x41 with \xc3
[+] All patches applied!
[+] Backing up original file at sublime_text.exe.bak
[+] Patched file written at sublime_text.exe
Enjoy! :)
----------------------------------------------------------------
Report any issues at github.com/rainbowpigeon/sublime-text-4-patcher/issues!
----------------------------------------------------------------

Ps: I installed requirements. Not working.

Screenshot

Also i check py code backing up exe file (exe.bak)

Linux Version please

Hi, first of all thanks for uploading this patcher. Really useful. A small request of mine is to upload a similar patcher for the Linux build of 4126v

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.