📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  IDAPython MakeCode()

Topic created on: July 30, 2008 22:35 CDT by Apu .

I am trying to get IDA to recognize some data as code. I can press 'C' and it works fine, but when I use IDAPython it does not work. I can patch the JMP+1 using PatchByte(ea). I have used do_unknown_range, MakeUnkn on the data portion of the file before calling MakeCode, but the results are the same.

text:000009F4
.text:000009F4 loc_9F4:                                ; CODE XREF: .text:loc_9F4j
.text:000009F4                 jmp     short near ptr loc_9F4+1
.text:000009F4 ; ---------------------------------------------------------------------------
.text:000009F6                 dw 48C0h
.text:000009F8                 dd 0FFEB4840h, 58064BC3h

I am trying to get the data at 09F6 - 09FF to get converted to code. Any help would be appreciated. Here is the code I have so far:

seg_start = SegByName(".text")
seg_end = SegEnd(seg_start)
start_data = 0
obfu = 0

for head in Heads(seg_start, seg_end):
    
    current_ea = NextHead(head, seg_end)
        
    if (Byte(current_ea)== 0xEB and Byte(current_ea + 1) == 0xFF and isData(GetFlags(current_ea +2))):
        
        PatchByte(current_ea, 0x90)
        MakeCode(current_ea)
        obfu = 1
        start_data_ea = NextHead(current_ea, seg_end)
        continue
    
    if (isData(GetFlags(current_ea)) and obfu == 1):
        
        data_ea = current_ea
        MakeUnkn(current_ea,0)
        
    if (isCode(GetFlags(current_ea))):
        
        if (obfu):
            
            obfu = 0
            range = data_ea - start_data_ea
            
            while(start_data_ea < current_ea):
                
                print "At: ", hex(start_data_ea)
                #MakeCode(start_data_ea)
                start_data_ea = nextaddr(start_data_ea)
                
            #print "start: ", hex(start_data_ea), "data: ", hex(current_ea - 1), "current: ", hex(current_ea)

No posts found under this topic.
Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit