CheckPointSW / Karta

Karta - source code assisted fast binary matching plugin for IDA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

karta_analyze_src.py on windows

jap0 opened this issue · comments

commented

Is it possible "execute IDAPython scripts outside IDA"? I am trying to run the karta_analyze_src.py via following command:
C:\Python27\Lib\site-packages\Karta-1.0.0-py2.7.egg\src>ida.exe -S"karta_analyze_src.py -D " -t
.. no matter what args I provide to the script, the result is always the same:
karta_analyze_src.py: error: too few arguments
karta2

commented

With few script modifications it worked:

  • mods in karta_analyze_src.py:
    -- added script parameters manually at the beginning of the script, example:
    margs = []
    margs.append("cryptopp")
    margs.append("5.6.4")
    margs.append("D:\cryptopp5\cryptopp564\Win32\cryptlib\Debug\")
    margs.append("D:\cryptopp5\cryptopp564\Win32\Output\Debug\cryptlib.lib")
    margs.append("--windows")
    -- added path strings - also at the beginning
    sys.path.insert(0, os.path.join(os.getenv("SystemDrive"), os.sep, "Python27", "Lib", "site-packages", "Karta-1.0.0-py2.7.egg", "src"))
    sys.path.insert(0, os.path.join(os.getenv("SystemDrive"), os.sep, "Python27", "Lib", "site-packages"))
    -- commented out following line and set it hardly to y (inputs does not work)
    orig code: new_path = prompter.input("Do you want to analyze all of
    new code: new_path = 'y'
    -- added own argument variable into main function (commented out the orig arguments)
    global margs
    #args = parser.parse_args(args)
    args = parser.parse_args(margs)
  • mods in config/utils.py:
    -- DISASSEMBLER_PATH set to "ida.exe" (path to ida.exe have added into system environment path)
    -- commented out last 3 lines of function "setDisassemblerPath" (to get rid of user input stuff)

now it works when I run the script from command line like: C:\Python27\Lib\site-packages\Karta-1.0.0-py2.7.egg\src>ida.exe -S"karta_analyze_src.py" -t

*hope this small tut will help somebody to save time :)

Sorry for the delayed response. You encountered an issue since karta_analyze_src.py should be invoked from the cmd line, and not from withing IDA. In turn, it activates the disassembler on each compiled file in the given input directory. Please read the documentation, as it will save you precious time.