Windows pe cracking

From bolone-sengkuni/hermes-brutal-mod · View interactive version

Windows pe cracking is an AI agent skill from the GitHub repository bolone-sengkuni/hermes-brutal-mod. Crack Windows PE to bypass auth or unlock features.

How to use this skill

Skill file

Windows PE Cracking

Reverse engineer and crack Windows PE executables to bypass authentication, remove license checks, or unlock premium features.

When to Use

Analysis Phase

1. Initial Reconnaissance

# Check file type and properties
file app.exe
strings app.exe | grep -iE 'license|key|trial|premium'

# PE structure analysis
pip install pefile
python3 << EOF
import pefile
pe = pefile.PE('app.exe')

# Check if packed
for section in pe.sections:
    entropy = section.get_entropy()
    print(f"{section.Name.decode().strip()}: entropy {entropy:.2f}")
    if entropy > 7.0:
        print("  ⚠️ Possibly packed/encrypted")

# Check imports
if hasattr(pe, 'DIRECTORY_ENTRY_IMPORT'):
    for entry in pe.DIRECTORY_ENTRY_IMPORT:
        print(f"\n{entry.dll.decode()}:")
        for imp in entry.imports[:10]:
            if imp.name:
                print(f"  {imp.name.decode()}")
EOF

2. Identify Protection Type

Self-extracting archive:

Anti-tamper protection:

Server-side validation:

Cracking Approaches

Approach 1: Static Patching (Simple Cases)

import pefile

exe_path = "app.exe"
output = "app_cracked.exe"

with open(exe_path, 'rb') as f:
    data = bytearray(f.read())

pe = pefile.PE(exe_path)
text_section = next(s for s in pe.sections if b'.text' in s.Name)
text_start = text_section.PointerToRawData
text_end = text_start + text_section.SizeOfRawData

patches = 0

# Pattern: CMP + JNE → NOP the JNE
for i in range(text_start, text_end - 6):
    if data[i] == 0x3D:  # CMP EAX, imm32
        if data[i+5] in [0x75, 0x0F]:  # JNE
            data[i+5] = 0x90
            data[i+6] = 0x90
            patches += 1

# Fix checksum
pe_new = pefile.PE(data=bytes(data))
pe_new.OPTIONAL_HEADER.CheckSum = pe_new.generate_checksum()

with open(output, 'wb') as f:
    f.write(pe_new.write())

print(f"Applied {patches} patches")

Test: Check MainWindowHandle with PowerShell:

Get-Process | Where {$_.ProcessName -like '*app*'} | Select MainWindowHandle

If MainWindowHandle = 0 → GUI init failed, use Approach 3

Approach 2: Keygen (Offline Validation)

with open('app.exe', 'rb') as f:
    data = f.read()

# Find key patterns
key_patterns = [b'KEY', b'License', b'Serial']
for pattern in key_patterns:
    offset = data.find(pattern)
    if offset != -1:
        context = data[offset-50:offset+100]
        print(f"{pattern} @ {hex(offset)}")

# Generate candidates
import hashlib
seeds = ["AppName", "Version", "Author"]
for seed in seeds:
    key = hashlib.md5(seed.encode()).hexdigest()[:16].upper()
    print(f"{seed} → {key}")

If server-side validation: Keygen won't work. Use Approach 3.

Approach 3: Runtime Memory Patching (Anti-tamper Bypass)

When to use: Static patches crash or GUI fails to appear.

See templates/patch.cpp and templates/injector.cpp for complete DLL injection solution.

Compile:

x86_64-w64-mingw32-g++ -shared -o patch.dll patch.cpp -lpsapi -static
x86_64-w64-mingw32-g++ -o injector.exe injector.cpp -static

Use:

# Place injector.exe, patch.dll, app.exe in same folder
./injector.exe

Pitfalls

Self-extracting archives misidentified as standalone apps

Static patches cause GUI failure (MainWindowHandle=0)

Over-patching critical code paths

Keygen with server-side validation

Checksum validation breaks patched exe

```python

pe.OPTIONAL_HEADER.CheckSum = pe.generate_checksum()

```

Tools

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.