8

Does anyone know of projects that parse the disassembly from IDA Pro using a lexer and/or parser generator library? But I would also totally be fine with JSON or XML format. So far, I have been able to produce HTML from the GUI, but I am looking for a command line tool that will parse disassembly files produced by IDA Pro.

turnersr
  • 173
  • 8
  • 3
    This sounds like an XY problem. What are you actually trying to do? – Igor Skochinsky Aug 12 '13 at 21:41
  • I am moving to IDA Pro disassembly in order to do my own static analysis. I had used Distorm in the past, but I want to experiment with IDA Pro. I am parsing asm files produced by IDA Pro disassembler to interface with an IR translator. It's that not that big of a deal I just do not want to reinvent the wheel here. What's a XY problem? – turnersr Aug 12 '13 at 21:51
  • I am actually trying to do this: "First, the binary file is disassembled. toil currently interfaces with two disassemblers: IDA Pro, a commercial disassembler, and a linear sweep disassembler built on top of GNU libopcodes. Interfacing with other disassemblers is straight-forward." (Very old BAP documentation). – turnersr Aug 12 '13 at 21:59
  • 2
    You're going at it backwards. Instead of parsing assembler text, you should use IDA scripting or native APIs to get the instructions in nice, broken down representation. – Igor Skochinsky Aug 12 '13 at 22:26
  • I am all ears if I can get a better representation. Are you suggesting using GetDisasm? What do you mean by broken down representation? Can you please point me to the right documentation? Thanks! – turnersr Aug 12 '13 at 23:34
  • I have a similar question or requirement asked by @turnersr. Is there any existing project that parses the disassembly file produced by the objdump or IDA pro using the lexer and parser library/tool or published project? – soaj33 Oct 16 '20 at 21:42
  • 1
    Welcome to RE.SE. If you have a different query that is not answered here then please ask a new question. – David Oct 16 '20 at 21:58

1 Answers1

5

You'd be better off using IDC functions like GetMnem(), GetOpType(), GetOperandValue(), etc. to extract IDA's disassembly than exporting to JSON/XML.

You can use command-line switches to run IDA in batch-mode with your IDC script to automate the entire process.

Jason Geffner
  • 20,681
  • 1
  • 36
  • 75