Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert large amount of code to data in IDA

Well, Unfortunately I hit 'C' on a data section of a binary i had worked a lot on and saved it as i had a lot of work unsaved. I tried converting this huge section back to data but whenever i select lines and press 'D', only the line where the cursor was gets converted to data.

So, My question is, How do i mark/convert a large amount of data to code in IDA (specifically 6.1)

(The target architecture is ARM if that matters).

like image 881
sgupta Avatar asked Dec 16 '22 14:12

sgupta


2 Answers

You could do it with a quick IDAPython script, e.g. enter:

for a in xrange(startaddr, endaddr): MakeCode(a)

into the 'Python' field of the Output window.

like image 149
David Thomas Avatar answered Jan 31 '23 00:01

David Thomas


D is to define a single data. You can go to the first instruction and use U for Undefine. It will remove more code than "Convert to data".

like image 37
Seki Avatar answered Jan 30 '23 23:01

Seki