jjj111144444
jjj111144444

Reputation: 61

Extracting IDA view-A data or Assembly from IDApython

I'm a newbie in IDApro.

I'd like to save the assembly code or IDA view-A(not a graph view) text through IDApro.

I know the how to save using GUI, but there are so many files i have to change.

So I wanna use python script embedded in IDApro called IDApython. I had tried to use gen_file function, but its not work properly.

for example, I use gen_file like this:

gen_file(OFILE_ASM, file_name, 0, idc.BADADDR, GENFLG_ASMTYPE)

Please let me know what kinds of way i can choose

Thanks

Upvotes: 1

Views: 979

Answers (1)

fpmurphy
fpmurphy

Reputation: 2537

This works for me in IDA 7.0 and later, and outputs the full IDA View-A contents when run from the Execute Script pane:

path = ida_kernwin.ask_file(1, "*.*", 'Output Filename')
num = gen_file(OFILE_ASM, path, 0, BADADDR, 0)
print("Bytes Written: 0x%x" % num)

Upvotes: 1

Related Questions