Last active
March 11, 2025 00:16
-
-
Save notareverser/1fbb0fb575159dffa34785a1dd2222a7 to your computer and use it in GitHub Desktop.
IDA Python script to NOP (x86/x64) selected bytes
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 idaapi as ia, idc | |
def PLUGIN_ENTRY(): return nop() | |
class nop(ia.plugin_t): | |
flags = ia.PLUGIN_UNL | |
comment = "NOP" | |
help = "select bytes, run" | |
wanted_name = "NOP bytes..." | |
wanted_hotkey = "Ctrl+Shift+N" | |
def init(self): return ia.PLUGIN_OK | |
def term(self): pass | |
def run(self, arg): | |
no = 0x90 | |
ib = idc.BADADDR | |
pb = idc.patch_byte | |
s1 = idc.read_selection_start() | |
e1 = idc.read_selection_end() | |
if s1 == ib or e1 == ib: pb(idc.here(), no) | |
else: | |
for x in range((e1-s1)): | |
pb(s1+x, no) | |
idc.create_insn(s1+x) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment