I am trying to run IDA without GUI. My purpose is to run a specific script that receives arguments via my main program against multiple files, but for some reason, it does not work for me. Sometimes it opens IDA without any reason.

I am using the following commands:

One command is: 'C:\\IDA\\ida.exe -B %s' % file

Second command is: cmd = 'C:\\IDA\\ida.exe -a- -A -S"script.py "%s"" %s' % (file, file)

  • How is IDA supposed to distinguish the script name from the parameter? You're using the exact same type of quotes (") to denote two different things. You're attempting to quote the overall script+parameters, but you seem to also be quoting the parameter(s) with the same type of quotes. Not sure how you execute this (i.e. which Python module), but cmd.exe is likely going to have an issue telling these apart ... not to mention that file names with blank spaces will garble up the whole thing anyway. – 0xC0000022L Dec 17 '19 at 22:49

ida.exe -A -S"<path\to\script> <params>" <path\to\file>

-A - autonomous mode - no dialog boxes.

You can use idat.exe instead if ida.exe, which will not open the GUI of IDA.

You can end your script with:

from idc import *

Which will exit the program when the script is finished.

You can see the complete list of command-line switches here

  • Hi, Thanks for the answer. after some tries(the script run) for some reason it does not rerun my scripts anymore. Do you know why ? I use the idat.exe as you said – Logan Dec 16 '19 at 16:13
  • 1
    Maybe your script fails/gets an exception and dies in certain cases? – macro_controller Dec 16 '19 at 16:55
  • No, nothing fail. – Logan Dec 16 '19 at 20:52
  • 1
    It's really hard to understand the issue without seeing the script. Another thing that you can do is to look in process monitor and see if instances are created and die, or it doesn't happen. – macro_controller Dec 17 '19 at 8:45
  • @DanielDan how do you know nothing fails? You gave us no indication that there is any error checking involved. – 0xC0000022L Dec 17 '19 at 22:50

You can make your IDApython script in this format below:

from idautils import *
from idaapi import *
from idc import *
import os
autoWait() # to wait until ida analysis finished
f=open('result.log')#output result to a file
# your script here 
f.write('run script')
exit() #close IDA after script finished

then use this command to run,you would see a GUI in a flash,Almost equivalent to no GUI.

./ida -A   -S"<path_to_your_script>" <path_of_binary>  -t

-A means auto run without interactive windows.
-t means make a temporary idb file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.