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)-
Save the code in a Python script (e.g.,
patcher.py). -
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 thesublime_text.exefile. -
The patched version will be saved in the same directory as the original file (or you can specify a custom output path).
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
import os
import sys
import importlib.util
import hashlib
import tkinter as tk
import subprocess, time, platform, tempfile, shutil, stat
from tkinter import ttk, filedialog, messagebox
from datetime import datetime
from types import ModuleType
from typing import Dict, Optional, Tuple, List
APP_NAME = "Byte Patcher Wrapper"
APP_VER = "1.3"
---------- helpers ----------
def _import_from_path(path: str, module_name: str) -> Optional[ModuleType]:
try:
spec = importlib.util.spec_from_file_location(module_name, path)
if not spec or not spec.loader:
return None
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod) # type: ignore[attr-defined]
return mod
except Exception as e:
messagebox.showerror("Import error", f"Failed to import core module:\n{path}\n\n{e}")
return None
def _auto_load_core() -> Tuple[Optional[ModuleType], str]:
here = os.path.abspath(os.path.dirname(file))
candidate = os.path.join(here, "patch.py")
if os.path.isfile(candidate):
mod = _import_from_path(candidate, "patch_core")
if mod:
return mod, candidate
return None, ""
def _extract_mapping(mod: ModuleType) -> Optional[Dict[int, int]]:
if not hasattr(mod, "offsets_and_values"):
return None
raw = getattr(mod, "offsets_and_values")
if not isinstance(raw, dict):
return None
m: Dict[int, int] = {}
for k, v in raw.items():
off = int(k, 16) if isinstance(k, str) and k.lower().startswith("0x") else int(k)
val = int(v)
if not (0 <= val <= 255):
raise ValueError(f"Byte out of range at 0x{off:X}: {val}")
m[off] = val
return m
def safe_backup(filepath: str) -> str:
folder = os.path.dirname(filepath)
base = os.path.basename(filepath)
bak = os.path.join(folder, base + ".bak")
if not os.path.exists(bak):
with open(filepath, "rb") as fi, open(bak, "wb") as fo:
fo.write(fi.read())
return bak
ts = datetime.now().strftime("%Y%m%d%H%M%S")
bak_ts = os.path.join(folder, f"{base}.bak.{ts}")
with open(filepath, "rb") as fi, open(bak_ts, "wb") as fo:
fo.write(fi.read())
return bak_ts
def _apply_local_patch(original: bytes, mapping: Dict[int, int]) -> Tuple[bytes, int]:
ba = bytearray(original)
changed = 0
for off, val in mapping.items():
if off < len(ba) and ba[off] != val:
ba[off] = val
changed += 1
return bytes(ba), changed
def _sha256_hex(data: bytes) -> str:
import hashlib as _hh
h = _hh.sha256(); h.update(data); return h.hexdigest()
def _preview_regions(data: bytes, mapping: Dict[int,int], context: int = 8) -> List[str]:
lines: List[str] = []
shown = 0
for off in sorted(mapping.keys()):
if shown >= 50: break
if off < len(data):
before = data[off]
after = mapping[off]
start = max(0, off - context)
end = min(len(data), off + context + 1)
ctx = " ".join(f"{b:02X}" for b in data[start:end])
lines.append(f"0x{off:08X} : {before:02X} -> {after:02X} ctx: {ctx[:90]}")
else:
lines.append(f"0x{off:08X} : OUT OF RANGE -> {mapping[off]:02X}")
shown += 1
return lines
---------- GUI ----------
class App(tk.Tk):
def init(self):
super().init()
self.title(f"{APP_NAME} {APP_VER}")
self.geometry("820x520")
self.minsize(680, 420)
self._center()
def main():
app = App()
app.mainloop()
if name == "main":
main()