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?

user3119546
  • 495
  • 4
  • 14

1 Answers1

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)
w s
  • 8,458
  • 1
  • 24
  • 40
  • 2
    I just debugged the answer to your previous question :) – w s Jan 07 '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 07 '14 at 17:15
  • I don't have idal anywhere inside "/Applications/IDA Pro 7.5", where is this script supposed to be located? – Zach Riggle Jan 26 '21 at 03:16
  • 1
    @ZachRiggle Actually any correct(32/64bitwise) ida executable should fit. – w s Jan 26 '21 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 – Zach Riggle Feb 08 '21 at 06:34