Files
ghidra-plugins/xor.py
2022-10-07 19:32:26 +02:00

33 lines
727 B
Python

# XORs the instructions in the current selection
#@author AlxCzl
#@category Instructions
#@keybinding
#@menupath
#@toolbar
#-------------------------------------------------------------------------------------------
def main():
"""Main"""
if not currentSelection:
print("[!] Please select the range to be xored")
return
print('[*] XORing byte range...')
addrRange = currentSelection.getAddressRanges().next()
currAddr = addrRange.minAddress
while currAddr < addrRange.maxAddress:
currVal = getByte(currAddr)
newVal = currVal ^ 0x42
setByte(currAddr, newVal)
currAddr = currAddr.add(1)
print('[*] Done.')
if __name__ == '__main__':
main()