Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion idapatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ def add_menu_items(self):
if self.add_menu_item_helper("View/Open subviews/Problems", "Patches", "", 1, self.show_patches_view, None): return 1
if self.add_menu_item_helper("Edit/Patch program/", "Edit selection...", "", 0, self.show_edit_form, None): return 1
if self.add_menu_item_helper("Edit/Patch program/", "Fill selection...", "", 0, self.show_fill_form, None): return 1
if self.add_menu_item_helper("Edit/Patch program/", "NOP selection (x86)...", "Alt-n", 0, self.x86_nop_region, None): return 1
if self.add_menu_item_helper("Edit/Export data...", "Import data...", "Shift-I", 1, self.show_import_form, None): return 1

return 0
Expand Down Expand Up @@ -593,6 +594,21 @@ def show_edit_form(self):
# Dispose the form
f.Free()

def x86_nop_region(self):
selection, start_ea, end_ea = idaapi.read_selection()

if not selection:
start_ea = idaapi.get_screen_ea()
end_ea = start_ea + 1

fill_value = 0x90

for ea in range(start_ea, end_ea):
idaapi.patch_byte(ea, fill_value)

# Refresh all IDA views
self.patch_view.Refresh()

# Fill range with a value form
def show_fill_form(self):
selection, start_ea, end_ea = idaapi.read_selection()
Expand Down Expand Up @@ -750,4 +766,4 @@ def idapatcher_main():

if __name__ == '__main__':
#idapatcher_main()
pass
pass