diff --git a/idapatcher.py b/idapatcher.py index 409dc27..b827d5d 100644 --- a/idapatcher.py +++ b/idapatcher.py @@ -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 @@ -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() @@ -750,4 +766,4 @@ def idapatcher_main(): if __name__ == '__main__': #idapatcher_main() - pass \ No newline at end of file + pass