blob: a6e280ccd8c0f728bd64957812c6a3c0b681cae0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
from binaryninja.architecture import Architecture, ArchitectureHook
class X86ReturnHook(ArchitectureHook):
def get_instruction_text(self, data, addr):
# Call the original implementation's method by calling the superclass
result, length = super(X86ReturnHook, self).get_instruction_text(data, addr)
# Patch the name of the 'retn' instruction to 'ret'
if len(result) > 0 and result[0].text == 'retn':
result[0].text = 'ret'
return result, length
# Install the hook by constructing it with the desired architecture to hook, then registering it
X86ReturnHook(Architecture['x86']).register()
|