feat(xor): now asks the user to enter a value at runtime
This commit is contained in:
8
xor.py
8
xor.py
@@ -5,7 +5,6 @@
|
|||||||
#@menupath
|
#@menupath
|
||||||
#@toolbar
|
#@toolbar
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------------------
|
|
||||||
def main():
|
def main():
|
||||||
"""Main"""
|
"""Main"""
|
||||||
|
|
||||||
@@ -13,14 +12,16 @@ def main():
|
|||||||
print("[!] Please select the range to be xored")
|
print("[!] Please select the range to be xored")
|
||||||
return
|
return
|
||||||
|
|
||||||
print('[*] XORing byte range...')
|
xorVal = askInt("xor value", "[*] Value to XOR the instructions with: ")
|
||||||
|
|
||||||
|
print('[*] XORing byte range with {}...'.format(xorVal))
|
||||||
|
|
||||||
addrRange = currentSelection.getAddressRanges().next()
|
addrRange = currentSelection.getAddressRanges().next()
|
||||||
currAddr = addrRange.minAddress
|
currAddr = addrRange.minAddress
|
||||||
|
|
||||||
while currAddr < addrRange.maxAddress:
|
while currAddr < addrRange.maxAddress:
|
||||||
currVal = getByte(currAddr)
|
currVal = getByte(currAddr)
|
||||||
newVal = currVal ^ 0x42
|
newVal = currVal ^ xorVal
|
||||||
setByte(currAddr, newVal)
|
setByte(currAddr, newVal)
|
||||||
currAddr = currAddr.add(1)
|
currAddr = currAddr.add(1)
|
||||||
|
|
||||||
@@ -29,4 +30,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user