Last active
July 3, 2025 16:48
-
-
Save expatjedi/ceca68690a45d36783d9ae14b1c1f03f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
127.0.0.1 www.sublimetext.com | |
127.0.0.1 sublimetext.com | |
127.0.0.1 sublimehq.com | |
127.0.0.1 license.sublimehq.com | |
127.0.0.1 45.55.255.55 | |
127.0.0.1 45.55.41.223 | |
0.0.0.0 license.sublimehq.com | |
0.0.0.0 45.55.255.55 |
This file contains hidden or 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
Step 1: | |
Download and install Sublime Text from: | |
https://download.sublimetext.com/sublime_text_build_4200_x64_setup.exe | |
Step 2: | |
Save the PowerShell code to Desktop with the name "SublimePatcher.ps1" | |
Step 3: | |
On Desktop, hold down Shift and right-click in an empty area, then select "Open PowerShell window here" | |
Step 4: | |
Run the PowerShell script by typing: | |
.\SublimePatcher.ps1 | |
Step 5: | |
After All Done Open Sublime Text and in main menu click to "Help" and click to "Enter License" and type "A" and click OK | |
Prompt MSG "License Done" | |
.................................................................................................................... | |
There are still a few steps in "Windows Defender Firewall with Advanced Security" to take to make everything safe. | |
................................................................................................................... | |
Important Notes: | |
You may need to run PowerShell as Administrator for the script to work properly | |
If you get an execution policy error, first run: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
The script will create a backup of your original Sublime Text executable | |
Make sure Sublime Text is closed before running the patcher | |
PowerShell Code: | |
$destFolder = "$env:USERPROFILE\Desktop\SUBLIME" | |
$sourceExe = "C:\Program Files\Sublime Text\sublime_text.exe" | |
$destExe = "$destFolder\sublime_text.exe" | |
$backupExe = "C:\Program Files\Sublime Text\sublime_text_backup.exe" | |
Write-Host "Starting Sublime Text patching process..." | |
if (-not (Test-Path -Path $sourceExe)) { | |
Write-Host "Error: Source file not found at $sourceExe" | |
exit | |
} | |
if (-not (Test-Path -Path $destFolder)) { | |
Write-Host "Creating SUBLIME folder..." | |
New-Item -Path $destFolder -ItemType Directory | Out-Null | |
} | |
Write-Host "Copying files to desktop folder..." | |
Copy-Item -Path $sourceExe -Destination $destExe -Force | |
$FilePath = $destExe | |
if (!(Test-Path $FilePath)) { | |
Write-Host "Error: File not found at $FilePath" | |
exit | |
} | |
$bytes = [System.IO.File]::ReadAllBytes($FilePath) | |
if ($bytes.Length -eq 0) { | |
Write-Host "Error: Failed to read the file or file is empty." | |
exit | |
} | |
function Apply-Patch { | |
param ( | |
[byte[]]$Find, | |
[byte[]]$Replace, | |
[string]$Description | |
) | |
$found = $false | |
for ($i = 0; $i -le $bytes.Length - $Find.Length; $i++) { | |
$match = $true | |
for ($j = 0; $j -lt $Find.Length; $j++) { | |
if ($bytes[$i + $j] -ne $Find[$j]) { | |
$match = $false | |
break | |
} | |
} | |
if ($match) { | |
for ($j = 0; $j -lt $Replace.Length; $j++) { | |
$bytes[$i + $j] = $Replace[$j] | |
} | |
Write-Host "Patch applied: $Description at offset 0x$("{0:X}" -f $i)" | |
$found = $true | |
break | |
} | |
} | |
if (-not $found) { | |
Write-Host "Failed to find pattern for patch: $Description" | |
} | |
} | |
Write-Host "Applying patches..." | |
$patches = @( | |
@{ Find = @(0x74, 0x06, 0x3B); Replace = @(0xEB, 0x06, 0x3B); Desc = "Patch 1: Change 74 to EB" }, | |
@{ Find = @(0x89, 0xF8, 0x48, 0x81, 0xC4, 0x38, 0x02); Replace = @(0x33, 0xC0, 0x48, 0x81, 0xC4, 0x38, 0x02); Desc = "Patch 2: 89 F8 to 33 C0" }, | |
@{ Find = @(0xE8, 0xF4, 0x7F, 0x10, 0x00); Replace = @(0x90, 0x90, 0x90, 0x90, 0x90); Desc = "Patch 3: Full 5-byte NOPs" }, | |
@{ Find = @(0x41, 0x57, 0x41, 0x56, 0x41, 0x54, 0x56, 0x57, 0x53, 0x48, 0x83, 0xEC, 0x38); Replace = @(0x90, 0x90, 0x41, 0x56, 0x41, 0x54, 0x56, 0x57, 0x53, 0x48, 0x83, 0xEC, 0x38); Desc = "Patch 4: 41 57 to 90 90" } | |
) | |
foreach ($patch in $patches) { | |
Apply-Patch -Find $patch.Find -Replace $patch.Replace -Description $patch.Desc | |
} | |
$patchedFilePath = "$destFolder\SublimeText_patched.exe" | |
Write-Host "Saving patched file..." | |
[System.IO.File]::WriteAllBytes($patchedFilePath, $bytes) | |
if (-not (Test-Path $patchedFilePath)) { | |
Write-Host "Error: Patched file was not created successfully" | |
exit | |
} | |
$originalBackupPath = "C:\Program Files\Sublime Text\sublime_text_backup.exe" | |
$targetPath = "C:\Program Files\Sublime Text\sublime_text.exe" | |
Write-Host "Creating backup of original file..." | |
Copy-Item -Path $targetPath -Destination $originalBackupPath -Force | |
Write-Host "Replacing original file with patched version..." | |
try { | |
Copy-Item -Path $patchedFilePath -Destination $targetPath -Force | |
Write-Host "SUCCESS: Sublime Text has been patched successfully!" | |
Write-Host "Original backup saved at: $originalBackupPath" | |
Write-Host "Working files saved in: $destFolder" | |
} catch { | |
Write-Host "Error: Failed to replace the original file. Error: $_" | |
Write-Host "You may need to run PowerShell as Administrator" | |
Write-Host "Patched file is available at: $patchedFilePath" | |
} |
Comments are disabled for this gist.