From 6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Thu, 27 Jan 2022 22:43:28 -0500 Subject: Format All Files --- python/examples/arch_hook.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'python/examples/arch_hook.py') diff --git a/python/examples/arch_hook.py b/python/examples/arch_hook.py index 452bd2b6..a6e280cc 100644 --- a/python/examples/arch_hook.py +++ b/python/examples/arch_hook.py @@ -1,16 +1,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) + 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' - # 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 - return result, length # Install the hook by constructing it with the desired architecture to hook, then registering it X86ReturnHook(Architecture['x86']).register() - -- cgit v1.3.1