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?
This is most likely caused by at least one of three issues:
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.
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.
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).
.\ida.exe
, or use the full path and an ampersand sign:& "C:\Program Files\IDA 7.0\ida.exe"