sharphy_patch_il
Modify CIL bytecode by replacing opcodes, adjusting branch targets, and writing a patched binary to alter execution flow, bypass validation, or insert NOP sleds.
Instructions
Surgically modifies CIL bytecode instructions by replacing target opcodes, adjusting branch targets, and emitting a patched binary. Use this tool when bypassing validation logic, inserting NOP sleds, or altering execution flow. Do NOT use for general obfuscation stripping (use 'sharphy_clean_obfuscation'). Mutates by writing a patched assembly to outputPath.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"assemblyPath": "<assemblyPath>",
"typeName": "<typeName>",
"methodName": "<methodName>",
"instructionOffset": "<instructionOffset>",
"newOpCode": "<newOpCode>",
"outputPath": "<outputPath>"
},
"name": "sharphy_patch_il"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| typeName | Yes | Fully qualified class name | |
| newOpCode | Yes | New CIL OpCode (e.g., Nop, Ldc_I4_1, Ret) | |
| methodName | Yes | Target method name | |
| outputPath | Yes | Destination path for the patched binary | |
| assemblyPath | Yes | Path to the target assembly | |
| instructionOffset | Yes | IL offset of the instruction to replace |