0

Part of Practical malware analysis Lab5, is to run a python script in IDA Pro

I have tried by going to Files-->Script command then I have pasted my python code:

sea = ScreenEA()

for i in range(0x00,0x50):
        b = Byte(sea+i)
        decoded_byte = b ^ 0x55
        PatchByte(sea+i,decoded_byte)

when I click Run it shows me this error:

NameError: name 'ScreenEA' is not defined

.

PS: when I tried to upload the script file it also shows the same error

I have tried idc.ScreenEA just to see what will happen but no luck.

2 Answers 2

2

This is a legacy API, deprecated in IDA 7.0 and removed in IDA 7.4. The new equivalent is idc.get_screen_ea() (or you can use idc.here() which still works).

0

You can use this script

import idautils 
import idaapi

sea = idc.here()

for i in range(0x00,0x50):
    b = ord(idaapi.get_bytes(sea+i, 1))
    decoded_byte = b ^ 0x55
    ida_bytes.patch_byte(sea+i,decoded_byte)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.