13 Security Lab

IDA Pro IDB2PAT for python3 본문

Computer Security/Analysis

IDA Pro IDB2PAT for python3

Maj0r Tom 2021. 3. 4. 23:27

Among the scripting tools provided by IDA pro flare, there is idb2pat.py that creates a signature.

The script is considered to work in python2, so it does not work properly in python3.

In the case of the most recent version, ida pro 7.5, since python3 is the default version, a script error occurs in the normal execution method.

Method 1. Set config USE_PYTHON2

* IDA's install path:  path/to/ida_install/python/use_python2
* The 'IDAUSR' directory:
   +  ~/.idapro/python/use_python2 (on Linux/OSX)
   + %APPDATA%\Hex-Rays\IDA Pro\python\use_python2 (on Windows)

 

Create a file called "use_python2" under the install path and make it run as python2. Make the file recognized as a configuration file when ida pro is loaded.

 

Method 2. Porting to suit python3

It works correctly if the following modifications are reflected.

line 38
    iter(itertools.count(start).__next__, end)
line 259
    sig += ".." * (32 - (len(sig) // 2))
line 296
    for ref_loc, ref in refs.items():
line 417
    filename = ask_file(1, name, "Enter the name of the pattern file")
line 467
    f.write(b"\r\n")
    f.write(b"---")
    f.write(b"\r\n")
line 474
    f.write(b"\r\n")
    f.write(b"---")
    f.write(b"\r\n")

 

IDA Pro FLARE git  github.com/fireeye/flare-ida/blob/master/python/flare/idb2pat.py

Comments