Skip to content

Instantly share code, notes, and snippets.

@Fadi002
Created May 23, 2025 22:20
Show Gist options
  • Select an option

  • Save Fadi002/51a505cece648915bc2f32f3b7e6b71d to your computer and use it in GitHub Desktop.

Select an option

Save Fadi002/51a505cece648915bc2f32f3b7e6b71d to your computer and use it in GitHub Desktop.
Crack Sublime Text 4.2.0.0 Build 4200 [latest version]
import sys
import os

NOP = 0x90
offsets_and_values = {
    0x00030170: 0x00,
    0x000A94D0: NOP, 0x000A94D1: NOP, 0x000A94D2: NOP, 0x000A94D3: NOP, 0x000A94D4: NOP, 0x000A94D5: NOP, 0x000A94D6: NOP, 0x000A94D7: NOP, 0x000A94D8: NOP, 0x000A94D9: NOP, 0x000A94DA: NOP, 0x000A94DB: NOP, 0x000A94DC: NOP, 0x000A94DD: NOP, 0x000A94DE: NOP, 0x000A94DF: NOP, 0x000A94E0: NOP, 0x000A94E1: NOP, 0x000A94E2: NOP, 0x000A94E3: NOP, 0x000A94E4: NOP, 0x000A94E5: NOP, 0x000A94E6: NOP, 0x000A94E7: NOP, 0x000A94E8: NOP, 0x000A94E9: NOP, 0x000A94EA: NOP, 0x000A94EB: NOP, 0x000A94EC: NOP, 0x000A94ED: NOP, 0x000A94EE: NOP, 0x000A94EF: NOP, 0x000A94F0: NOP, 0x000A94F1: NOP, 0x000A94F2: NOP, 0x000A94F3: NOP, 0x000A94F4: NOP, 0x000A94F5: NOP, 0x000A94F6: NOP, 0x000A94F7: NOP, 0x000A94F8: NOP, 0x000A94F9: NOP, 0x000A94FA: NOP, 0x000A94FB: NOP, 0x000A94FC: NOP, 0x000A94FD: NOP, 0x000A94FE: NOP, 0x000A94FF: NOP, 0x000A9500: NOP, 0x000A9501: NOP, 0x000A9502: NOP, 0x000A9503: NOP, 0x000A9504: NOP, 0x000A9505: NOP, 0x000A9506: NOP, 0x000A9507: NOP, 0x000A9508: NOP, 0x000A9509: NOP, 0x000A950A: NOP, 0x000A950B: NOP, 0x000A950C: NOP, 0x000A950D: NOP, 0x000A950E: NOP, 0x000A950F: NOP,
    0x001C6CCD: 0x02,
    0x001C6CE4: 0x00,
    0x001C6CFB: 0x00,
}

def patch_exe(input_file, output_file=None):
    output_file = output_file or f"{os.path.splitext(input_file)[0]}_patched.exe"
    try:
        with open(input_file, 'rb') as f:
            data = f.read()
        patched_data = bytearray(data)
        for offset, value in offsets_and_values.items():
            if offset < len(patched_data):
                patched_data[offset] = value
        with open(output_file, 'wb') as f:
            f.write(patched_data)
        print(f"[+] Patch applied successfully! Saved as: {output_file}")

    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python patcher.py <input_file> [output_file]")
    else:
        patch_exe(sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else None)

How to Run:

  1. Save the code in a Python script (e.g., patcher.py).

  2. Open the terminal/command prompt and run the script like so:

    python patcher.py "path_to_sublime_text.exe"

    Replace "path_to_sublime_text.exe" with the actual path to the sublime_text.exe file.

  3. The patched version will be saved in the same directory as the original file (or you can specify a custom output path).

Note:

Please be aware that even after applying the patch, the status may still display as (UNREGISTERED). This is normal, and you can safely disregard this message because the app is already activited.
big thanks to @AdvDebug

@fredquie

Copy link
Copy Markdown

Stop-Process -Name "sublime_text" -ErrorAction SilentlyContinue; $path = "C:\Program Files\Sublime Text\sublime_text.exe"; if (Test-Path $path) { Copy-Item $path "$path.bak" -Force; [byte[]]$b = [System.IO.File]::ReadAllBytes($path); $s = byte[]; $r = byte[]; for($i=0; $i -le $b.Length - $s.Length; $i++){ $match=$true; for($j=0; $j -lt $s.Length; $j++){ if($b[$i+$j] -ne $s[$j]){ $match=$false; break } }; if($match){ for($j=0; $j -lt $s.Length; $j++){ $b[$i+$j] = $r[$j] }; break } }; [System.IO.File]::WriteAllBytes($path, $b); Write-Host "Patch applied and .bak backup created successfully!" -ForegroundColor Green } else { Write-Host "Error: sublime_text.exe not found in the default path." -ForegroundColor Red }

Works great ! Thx

@drubicza

drubicza commented Sep 15, 2026 •

Copy link
Copy Markdown
  • Sublime Text Dev 4211 (Linux & Windows)
  • Sublime Merge Stable 2130 (Linux & Windows)

st4011-linux sm2130-linux

ss-st-4211 ss-sm-2130

@drubicza

drubicza commented Sep 17, 2026 •

Copy link
Copy Markdown
  • Sublime Text Build 4212 Linux
sublime-text-4212-linux
  • Sublime Merge Build 2132 Linux
sublime-merge-2132

@aljawaid

Copy link
Copy Markdown
  • Sublime Text Build 4212 Linux
sublime-text-4212-linux
* Sublime Merge Build 2132 Linux
sublime-merge-2132

can you please explain how to do it for Windows 11 with python installed in powershell for sublime text and sublime merge? none of the instructions seem to work

@ubuntuvim

Copy link
Copy Markdown
image

very good!!! thank you ...

@ijd

ijd commented Sep 21, 2026

Copy link
Copy Markdown

4213 anyone?

Replace 0F B6 51 0C 83 F2 01 with C6 41 0C 01 31 D2 90

@Ser4ph4

Ser4ph4 commented Sep 21, 2026 •

Copy link
Copy Markdown

4213 anyone?

Replace 0F B6 51 0C 83 F2 01 with C6 41 0C 01 31 D2 90

Thanks :)

Work:
sudo perl -pi -e 's/\x0F\xB6\x51\x0C\x83\xF2\x01/\xC6\x41\x0C\x01\x31\xD2\x90/' /opt/sublime_text/sublime_text

@drubicza

drubicza commented Sep 22, 2026 •

Copy link
Copy Markdown
  • Sublime Text 4213 Windows
st-4213-win
  • Sublime Text 4213 Linux
sublime-text-4213-linux

@kian1990

Copy link
Copy Markdown

4213 macos arm?

@xinshoutw

xinshoutw commented Sep 22, 2026 •

Copy link
Copy Markdown

4213 macos arm?

MacOS Silicon Arm

Replace 09 31 40 39 4A 00 80 52 3F 01 00 71 E9 13 8A 1A with 29 00 80 52 09 31 00 39 E9 03 1F 2A 1F 20 03 D5

  1. Modify: sudo perl -pi -e 's/\x09\x31\x40\x39\x4A\x00\x80\x52\x3F\x01\x00\x71\xE9\x13\x8A\x1A/\x29\x00\x80\x52\x09\x31\x00\x39\xE9\x03\x1F\x2A\x1F\x20\x03\xD5/' /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
  2. Resign: sudo codesign --force --sign - --preserve-metadata=identifier,entitlements,flags,runtime /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
Sublime Text 2026-09-22 at 21 31 34@2x

@TheGridRepo

Copy link
Copy Markdown

Sublime Text 4213 Windows any hex code for this

@kian1990

Copy link
Copy Markdown

4213 macos arm?

MacOS Silicon Arm

Replace 09 31 40 39 4A 00 80 52 3F 01 00 71 E9 13 8A 1A with 29 00 80 52 09 31 00 39 E9 03 1F 2A 1F 20 03 D5

  1. Modify: sudo perl -pi -e 's/\x09\x31\x40\x39\x4A\x00\x80\x52\x3F\x01\x00\x71\xE9\x13\x8A\x1A/\x29\x00\x80\x52\x09\x31\x00\x39\xE9\x03\x1F\x2A\x1F\x20\x03\xD5/' /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
  2. Resign: sudo codesign --force --sign - --preserve-metadata=identifier,entitlements,flags,runtime /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
Sublime Text 2026-09-22 at 21 31 34@2x

thank you !!!

@wirabae

wirabae commented Sep 23, 2026 •

Copy link
Copy Markdown

Sublime Text Build 4213
Copy the script, save it with the .ps1 extension, and then run it using PowerShell.

change your location path
Happy coding!

gambar
$path = "C:\Program Files\Sublime Text\sublime_text.exe"
$bytes = [System.IO.File]::ReadAllBytes($path)$old = "0F-B6-51-0C-83-F2-01"
$new = "C6-41-0C-01-31-D2-90"

# Lakukan backup file exe terlebih dahulu
Copy-Item $path "$path.bak" -Force

# Konversi hex string ke byte array dan timpa file
$hexOld = $old.Split('-') \vert{} ForEach-Object { [byte]"0x$_" }
$hexNew = $new.Split('-') \vert{} ForEach-Object { [byte]"0x$_" }

# Proses patch
for ($i = 0; $i -le$bytes.Length - $hexOld.Length; $i++) {
    $match =$true
    for ($j = 0; $j -lt $hexOld.Length; $j++) {
        if ($bytes[$i +$j] -ne $hexOld[$j]) { $match =$false; break }
    }
    if ($match) {
        for ($j = 0; $j -lt$hexNew.Length; $j++) {$bytes[$i +$j] = $hexNew[$j]
        }
        [System.IO.File]::WriteAllBytes($path,$bytes)
        Write-Host "Patch Berhasil diterapkan!" -ForegroundColor Green
        break
    }
}

@drubicza

drubicza commented Sep 23, 2026 •

Copy link
Copy Markdown
  • Sublime Text Build 4214 Linux
sublime-text-build-4214-linux
  • Sublime Text Build 4214 Windows
st-4214-win

@iskndrcnr

iskndrcnr commented Sep 23, 2026 •

Copy link
Copy Markdown

Copy the script, save it with the .ps1 extension, and then run it using PowerShell.

change your location path Happy coding!

gambar

Good idea, thanks! But I added some improvements below—it's much better now.

if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
{  
 $arguments = "& '" +$myinvocation.mycommand.definition + "'"
 Start-Process powershell -Verb runAs -ArgumentList $arguments
 Break
}

$path = "C:\Program Files\Sublime Text\sublime_text.exe"

$old = "0F-B6-51-0C-83-F2-01"
$new = "C6-41-0C-01-31-D2-90"
$found = $false

Stop-Process -Name sublime_text -Force -ErrorAction SilentlyContinue
Copy-Item $path "$path.bak" -Force
$bytes = [System.IO.File]::ReadAllBytes($path)

$hexOld = $old.Split('-') | ForEach-Object { [byte]"0x$_" }
$hexNew = $new.Split('-') | ForEach-Object { [byte]"0x$_" }

for ($i = 0; $i -le $bytes.Length - $hexOld.Length; $i++) {
   $match = $true

   for ($j = 0; $j -lt $hexOld.Length; $j++) {
       if ($bytes[$i + $j] -ne $hexOld[$j]) {
           $match = $false
           break
       }
   }

   if ($match) {
       for ($j = 0; $j -lt $hexNew.Length; $j++) {
           $bytes[$i + $j] = $hexNew[$j]
       }

       [System.IO.File]::WriteAllBytes($path, $bytes)
       $found = $true
       break
   }
}

if ($found) {
   Write-Host "Done - Target Patched!" -ForegroundColor Green
} else {
   Write-Host "Failed - Target Hex Not Matched!" -ForegroundColor Red
}

Start-Sleep -Seconds 5

@wirabae

wirabae commented Sep 24, 2026

Copy link
Copy Markdown

Good idea, thanks! But I added some improvements below—it's much better now.

ahhh, Thank you for the revisions.

@mdsdtech

Copy link
Copy Markdown

Sublime Text 4 4215?

@xinshoutw

Copy link
Copy Markdown

MacOS Silicon 4215
Replace 09 31 40 39 4A 00 80 52 3F 01 00 71 E9 13 8A 1A with 29 00 80 52 09 31 00 39 E9 03 1F 2A 1F 20 03 D5 too

@TheReplicant07

Copy link
Copy Markdown

Will above work for 4215 - linux?

@Hargriv

Hargriv commented Sep 25, 2026 •

Copy link
Copy Markdown

The Windows version 4215 works with the old instruction 4213.
Patch for version 4215 same as 4213: find and replace 0f b6 51 0c 83 f2 01 with c6 41 0c 01 31 d2 90 in the sublime_text binary

@vatodevops

Copy link
Copy Markdown

Linux 4215 same as 4213:

Work:
sudo perl -pi -e 's/\x0F\xB6\x51\x0C\x83\xF2\x01/\xC6\x41\x0C\x01\x31\xD2\x90/' /opt/sublime_text/sublime_text

@z0h1r-LK

Copy link
Copy Markdown
image Yes! Its working also in ST4 build 4215 Thank you ♥

@TheReplicant07

TheReplicant07 commented Sep 25, 2026 •

Copy link
Copy Markdown

Linux 4215 same as 4213:

Work: sudo perl -pi -e 's/\x0F\xB6\x51\x0C\x83\xF2\x01/\xC6\x41\x0C\x01\x31\xD2\x90/' /opt/sublime_text/sublime_text

Worked - Fedora 44 / 4215. Thank you! 💙

Screenshot From 2026-09-25 19-23-46

@wirabae

wirabae commented Sep 26, 2026 •

Copy link
Copy Markdown
# ==============================================================================
# Script Patch Sublime Text 4 (Build 4213 & 4215) - Windows x64
# ==============================================================================

# 1. Make sure the script is run as Administrator
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host " [!] Please run PowerShell as Administrator!" -ForegroundColor Red
Pause
exit
}

# 2. Close the Sublime Text process if it is running.
$process = Get-Process -Name "sublime_text" -ErrorAction SilentlyContinue
if ($process) {
Write-Host " [*] Closing the running Sublime Text...." -ForegroundColor Yellow
Stop-Process -Name "sublime_text" -Force
Start-Sleep -Seconds 1
}

# 3. Target file location
$path = "C:\Program Files\Sublime Text\sublime_text.exe"

if (-not (Test-Path $path)) {
Write-Host " [!] File sublime_text.exe not found in: $path" -ForegroundColor Red
Pause
exit
}

# 4. Target Byte Pattern (Build 4213 & 4215)
$old = "0F-B6-51-0C-83-F2-01"
$new = "C6-41-0C-01-31-D2-90"

# 5. Create a backup copy (Backup)
Write-Host " [*] Creating backup file: sublime_text.exe.bak...." -ForegroundColor Cyan
Copy-Item $path "$path.bak" -Force

# 6. Convert hex string to byte array
$bytes = [System.IO.File]::ReadAllBytes($path)
$hexOld = $old.Split('-') | ForEach-Object { [byte]"0x$_" }
$hexNew = $new.Split('-') | ForEach-Object { [byte]"0x$_" }

# 7. Byte Search and Replace Process
$patched = $false
for ($i = 0; $i -le $bytes.Length - $hexOld.Length; $i++) {
$match = $true
for ($j = 0; $j -lt $hexOld.Length; $j++) {
if ($bytes[$i + $j] -ne $hexOld[$j]) { 
$match = $false
break 
}
}
if ($match) {
for ($j = 0; $j -lt $hexNew.Length; $j++) {
$bytes[$i + $j] = $hexNew[$j]
}
[System.IO.File]::WriteAllBytes($path, $bytes)
$patched = $true
break
}
}

# 8. Show Execution Results
if ($patched) {
Write-Host " [+] Patch successfully applied to Sublime Text.!" -ForegroundColor Green
} else {
Write-Host " [!] Byte pattern not found. The file may have already been patched, or the version does not match.." -ForegroundColor Yellow
}

Pause 
gambar

@denimus

denimus commented Sep 27, 2026 •

Copy link
Copy Markdown

Thx, don't get it why you ignored so many details if you rewrote your older code, here how proper Power Shell should look:

# ==============================================================================
# Script Patch Sublime Text 4 (Build 4213 & 4215) - Windows x64
# ==============================================================================

# Admin elevation
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit;
}

# Set vars
$path = "C:\Program Files\Sublime Text\sublime_text.exe";
if (-not (Test-Path $path)) { Write-Host " [!] File not found: $path" -ForegroundColor Red; pause; exit; }

[byte[]]$old = @(0x0F, 0xB6, 0x51, 0x0C, 0x83, 0xF2, 0x01);
[byte[]]$new = @(0xC6, 0x41, 0x0C, 0x01, 0x31, 0xD2, 0x90);

# Read file and search for pattern
[byte[]]$bytes = [System.IO.File]::ReadAllBytes($path);$index = -1;
$searchPos = 0;

while ($searchPos -ge 0 -and$searchPos -le ($bytes.Length -$old.Length)) {
    $foundPos = [System.Array]::IndexOf($bytes, $old[0],$searchPos);
    if ($foundPos -eq -1 -or$foundPos -gt ($bytes.Length -$old.Length)) { break; }
    
    $match =$true;
    for ($j = 1; $j -lt $old.Length; $j++) {
        if ($bytes[$foundPos +$j] -ne $old[$j]) { $match =$false; break; }
    }
    
    if ($match) { $index =$foundPos; break; }
    $searchPos =$foundPos + 1;
}

# Stop process, backup and patch if bytes match
if ($index -ge 0) {
    Get-Process "sublime_text" -ErrorAction SilentlyContinue | Stop-Process -Force;
    Copy-Item $path "$path.bak" -Force;
    
    [System.Array]::Copy($new, 0,$bytes, $index,$new.Length);
    [System.IO.File]::WriteAllBytes($path,$bytes);
    
    Write-Host " [+] Patch applied successfully at 0x$($index.ToString('X'))! Backup created." -ForegroundColor Green;
} else {
    Write-Host " [!] Byte pattern not found. No backup created." -ForegroundColor Yellow;
}

pause;

@drubicza

Copy link
Copy Markdown
st-4215

@wirabae

wirabae commented Sep 27, 2026

Copy link
Copy Markdown
# ==============================================================================
# Script Patch Sublime Text 4 (Build 4213 & 4215) - Windows x64
# ==============================================================================

# Admin elevation
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit;
}

# Set vars
$path = "C:\Program Files\Sublime Text\sublime_text.exe";
if (-not (Test-Path $path)) { Write-Host " [!] File not found: $path" -ForegroundColor Red; pause; exit; }

[byte[]]$old = @(0x0F, 0xB6, 0x51, 0x0C, 0x83, 0xF2, 0x01);
[byte[]]$new = @(0xC6, 0x41, 0x0C, 0x01, 0x31, 0xD2, 0x90);

# Read file and search for pattern
[byte[]]$bytes = [System.IO.File]::ReadAllBytes($path);$index = -1;
$searchPos = 0;

while ($searchPos -ge 0 -and$searchPos -le ($bytes.Length -$old.Length)) {
    $foundPos = [System.Array]::IndexOf($bytes, $old[0],$searchPos);
    if ($foundPos -eq -1 -or$foundPos -gt ($bytes.Length -$old.Length)) { break; }
    
    $match =$true;
    for ($j = 1; $j -lt $old.Length; $j++) {
        if ($bytes[$foundPos +$j] -ne $old[$j]) { $match =$false; break; }
    }
    
    if ($match) { $index =$foundPos; break; }
    $searchPos =$foundPos + 1;
}

# Stop process, backup and patch if bytes match
if ($index -ge 0) {
    Get-Process "sublime_text" -ErrorAction SilentlyContinue | Stop-Process -Force;
    Copy-Item $path "$path.bak" -Force;
    
    [System.Array]::Copy($new, 0,$bytes, $index,$new.Length);
    [System.IO.File]::WriteAllBytes($path,$bytes);
    
    Write-Host " [+] Patch applied successfully at 0x$($index.ToString('X'))! Backup created." -ForegroundColor Green;
} else {
    Write-Host " [!] Byte pattern not found. No backup created." -ForegroundColor Yellow;
}

pause;

Sorry, I wasn't focused when I made it; thank you for the correction.

@7p7

7p7 commented Sep 30, 2026

Copy link
Copy Markdown

MacOS Silicon 4215 Replace 09 31 40 39 4A 00 80 52 3F 01 00 71 E9 13 8A 1A with 29 00 80 52 09 31 00 39 E9 03 1F 2A 1F 20 03 D5 too

Not work on macos 26 Apple Silicon.

@tazihad

tazihad commented Oct 3, 2026 •

Copy link
Copy Markdown

worked for flatpak sublime text Build 4215
disable network:

flatpak override --user --unshare=network com.sublimehq.SublimeText

than

sudo perl -pi -e 's/\x0F\xB6\x51\x0C\x83\xF2\x01/\xC6\x41\x0C\x01\x31\xD2\x90/' /var/lib/flatpak/app/com.sublimehq.SublimeText/x86_64/stable/active/files/extra/sublime_text/sublime_text

@Oliverccccct

Copy link
Copy Markdown

4213 macos arm?

MacOS Silicon Arm

Replace 09 31 40 39 4A 00 80 52 3F 01 00 71 E9 13 8A 1A with 29 00 80 52 09 31 00 39 E9 03 1F 2A 1F 20 03 D5

  1. Modify: sudo perl -pi -e 's/\x09\x31\x40\x39\x4A\x00\x80\x52\x3F\x01\x00\x71\xE9\x13\x8A\x1A/\x29\x00\x80\x52\x09\x31\x00\x39\xE9\x03\x1F\x2A\x1F\x20\x03\xD5/' /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
  2. Resign: sudo codesign --force --sign - --preserve-metadata=identifier,entitlements,flags,runtime /Applications/Sublime\ Text.app/Contents/MacOS/sublime_text
Sublime Text 2026-09-22 at 21 31 34@2x

Thanks so much!!! It's working!

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