I am using IDA Pro 6 and I'm looking for a way to automatically export an analysed file into a listing (.lst) file.
The interface of IDA enables to do this action using the menu File > Produce File > Create LST file..., but I could not find a way to execute this action in batch mode (by running IDA in a terminal with the -B). The Hex-Rays's help page does not seem to help, as I'm unable to find a switch that matches my needs.
Is there any way I could get the listing out of IDA in an automated way ? Maybe with a IDC/Python script ?
A typical listing I would need is composed of the address location, bytes and assembly for each instruction, such as below (the lines with only comments or variables declaration can be omitted if there is no other possibility):
text:004016B0 ; =============== S U B R O U T I N E ======================================= .text:004016B0 .text:004016B0 ; Attributes: noreturn bp-based frame .text:004016B0 .text:004016B0 ___report_gsfailure proc near ; CODE XREF: __security_check_cookie(x):$failure$3j .text:004016B0 .text:004016B0 var_324 = dword ptr -324h .text:004016B0 var_8 = dword ptr -8 .text:004016B0 var_4 = dword ptr -4 .text:004016B0 .text:004016B0 8B FF mov edi, edi .text:004016B2 55 push ebp .text:004016B3 8B EC mov ebp, esp .text:004016B5 81 EC 24 03 00+ sub esp, 324h .text:004016BB A3 40 21 40 00 mov dword_402140, eax .text:004016C0 89 0D 3C 21 40+ mov dword_40213C, ecx .text:004016C6 89 15 38 21 40+ mov dword_402138, edx .text:004016CC 89 1D 34 21 40+ mov dword_402134, ebx .text:004016D2 89 35 30 21 40+ mov dword_402130, esi .text:004016D8 89 3D 2C 21 40+ mov dword_40212C, edi