4

I am using IDA Pro 6.5 and running it via terminal with the following command line switches:

  1. -B (to run in batch mode, should automatically generate a .asm file containing results)
  2. -S running a script in which the only functionality is to convert all of the binary into instruction.

When I ran in batch mode prior to the script, it would generate a .asm file that I would then be able to manipulate. However, now this file doesn’t appear. Is there a quick fix or any IDA Python methods I can include in order to create an output file?

1 Answer 1

6

Here it is. Run it with idal -c -A -S./script.py ./test.bin

# I didn't check this code, please use carefully !
# IDAPython documentation is at https://www.hex-rays.com/products/ida/support/idapython_docs/

import idautils
import idc

for ea in idautils.Segments():
    segend = idc.GetSegmentAttr(ea, idc.SEGATTR_END)
    start = ea
    while start < segend:
        idc.MakeCode(start)
        start = idc.FindUnexplored(start+1, idc.SEARCH_DOWN)

idc.GenerateFile(idc.OFILE_ASM, idc.GetInputFile()+".asm", 0, idc.BADADDR, 0)

idc.Exit(0)
5
  • 2
    I just debugged the answer to your previous question :)
    – w s
    Jan 7, 2014 at 17:13
  • Thanks! Yes I was working on the GenerateFile function but wasn't quite sure how to get the full functionality. Jan 7, 2014 at 17:15
  • I don't have idal anywhere inside "/Applications/IDA Pro 7.5", where is this script supposed to be located? Jan 26, 2021 at 3:16
  • 1
    @ZachRiggle Actually any correct(32/64bitwise) ida executable should fit.
    – w s
    Jan 26, 2021 at 11:07
  • @ws It appears the issue is that the binary I wanted is idat not idal. Thanks in any case! After adjusting my $PATH, now I have: $ which idat == /Applications/IDA Pro 7.5/ida.app/Contents/MacOS/idat Feb 8, 2021 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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