Created
September 12, 2024 08:47
-
-
Save Jasemalsadi/00ec2277b1972023d7a8282c395f8bc8 to your computer and use it in GitHub Desktop.
Remove "/" affect from IDA’s decompiler & disassembler overlap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ida_funcs | |
| import idc | |
| import re | |
| # Get the current address (cursor position) | |
| ea = idc.get_screen_ea() | |
| idaapi.msg_clear() | |
| # Define the regex pattern to match comments that start with "; " followed by multiple digits and a colon | |
| pattern = re.compile(r"^; \d+:") | |
| # Get the function object at the current address | |
| func = ida_funcs.get_func(ea) | |
| if func is None: | |
| print("No function found at the current address.") | |
| else: | |
| # Get the end address of the function | |
| end_ea = func.end_ea | |
| print(f"Function starts at {hex(func.start_ea)} and ends at {hex(end_ea)}") | |
| # Iterate through each address from the current cursor position to the end of the function | |
| while ea < end_ea: | |
| # Get the anterior extra comment at the current address (type 0 is for anterior comments) | |
| comment = idc.get_extra_cmt(ea, E_PREV) | |
| # Check if the comment exists and matches the pattern | |
| if comment and pattern.match(comment): | |
| print(f"Deleting..matching comment at {hex(ea)}: {comment}") | |
| idc.del_extra_cmt(ea, E_PREV) | |
| # Move to the next instruction | |
| ea = idc.next_head(ea, end_ea) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment