1

I'm trying to run a script with IDAPython on Windows:

PS: C:\Users\user\Downloads> ida.exe -S"tmp.py" -t
>>
PS: C:\Users\user\Downloads>

and I had to press Ctrl+C to get out of the >> prompt.

Why is that?

How should I run the script?

2
  • Seems to me like a powershell thing and not IDA. Try executing .\ida.exe , or use the full path and an ampersand sign: & "C:\Program Files\IDA 7.0\ida.exe"
    – Megabeets
    Commented Jan 11, 2018 at 13:16
  • For more information on the "-S, -A, and -B, and -c" options in command line, get the answer from the creator of IDA himself: reverseengineering.stackexchange.com/questions/18441/…
    – Peter Teoh
    Commented Mar 5, 2021 at 16:23

1 Answer 1

2

This is most likely caused by at least one of three issues:

  1. The first time IDA starts up on a machine, it'll prompt you for a license and you'll have to accept it. If the first time you run IDA is with the -S flag, IDA will hang on that screen and you'll need to manually accept it (either in that execution or a previous one). You could also work around it by manually creating the marker IDA uses, but i'll let you figure that out yourself.

  2. While running, IDA pops up multiple other dialogs you'll need to accept, answer and approve (the disassemble a new file, one loading symbols, etc...) those may be automatically dismissed by providing the -A flag (A stands for autonomous). This won't avoid the license agreement mentioned in the previous paragraph, and will even make it hidden and harder to accept.

  3. Your script may no be behaving with IDA. This basically means that IDA is designed as an interactive tool and not a command line tool, and one side-effect of that is that it will not automatically perform a peaceful exit once the executed script is done. You'll have to call idc.Exit(exitcode) when your script finished, or otherwise it'll just hang in there forever. You may also want to consider calling AutoWait()` at the beginning of your script.

P.S.

You may want to consider the -A and/or -c (and there's a small chance you'll want to look at -a as well) flags instead of the -t one (which I don't think will do what you desire).

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.