0

I have a simple python script that i wrote for IDA, but i'am can't figure out what am i doing wrong.

file = open("c:\\example.txt", "r")

for line in file:
    if line == "":
        pass
    else:
        addr =  line.split(None,1)

    if len(addr) < 2:
        pass
    else:
        address = ''.join(addr[0])
        if(idc.Jump(address)):
            sea = ScreenEA()
        else:
            print "There is a problem with the destenation address"

        counter = 0
        for l in addr[1]:
            PatchByte(sea+counter, ord(l))
            counter += 1


file.close()

Tow lines from example.txt file:

0x1001b3a4               Kernel32.DLL
0x1001b3c8                 CreateToolhelp32Snapshot

The error message i get is:

enter image description here

obvious to me the error is at if(idc.Jump(address)): line, and i have tried to call that with if(Jump(addr[0])): but i am getting the same error message.

I saw the Jump function at the official doc, but it seems like i am passing the right argument to it.

What could be the problem?

Hanan
  • 1,169
  • 3
  • 23
  • 40
  • You do not use *pass* on positive result - it is wasteful and unnecessary, you negate condition. in this case *if not line == "":* is equivalent to *if line:* - non-empty strib in Python is equivalent to *True* in logical expressions (actually, it is more complicated, but that will suffice for now) – volcano Oct 28 '12 at 09:13

1 Answers1

2

I think the problem is that you are passing a string to Jump(). Accordingly to the docs it has to be a long.

Vicent
  • 5,322
  • 2
  • 28
  • 36