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?

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)
  • 2
    I just debugged the answer to your previous question :) – w s Jan 7 '14 at 17:13
  • Thanks! Yes I was working on the GenerateFile function but wasn't quite sure how to get the full functionality. – user3119546 Jan 7 '14 at 17:15

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.