📚 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  >>  IDA Fixup for ELF Not Working

Topic created on: March 19, 2007 10:25 CDT by cyphunk .

I tried to load dmesg and ls from a suse 9.2 system and IDA 4.9 cuts short (very short) the .rel.plt and the .dynsym segements (PLT and Symbol Table, respectively).  Hence, none of the system functions are mapped.  Anyone have a nice solution for this?

at the moment I am considering writing my own fixup plugin which will take a objdump -r output and properly rename the functions of the PLT.  Better ideas?

  cyphunk   March 26, 2007 05:03.55 CDT
here is a small ida python script that takes the output of obdjump -R and renames functions in the PLT to proper function names.  When run it will ask for the location of the file containing the output of objdump -R.  It uses c++filt from cygwin to then unmangle any mangled names.

import re
import tkFileDialog
import subprocess
from Tkinter import *
from idaapi import *
from idautils import *
import sys
import os

nameappend = "_."
cppfilt = "c:\\usr\\cygwin\\bin\\c++filt.exe"

#
# ASK USER FOR OBJDUMP OUTPUT:
#
# A bug in how IDA python deals with sys requires we set baseName:
root = Tk(baseName="c:")
root.withdraw()
filename = tkFileDialog.askopenfilename(title="Import Objdump -R output file",
                                        filetypes=[("All files", "*")])
if filename == "":  exit
try:
    fh = open(filename)
    print "Opening %s" % filename
    filelines = fh.read().splitlines()
    fh.close()
except IOError,msg:
    print "error reading %s: %s" % (filename, msg)

#
# PARSE OBJDUMP INTO .got SEGMENT ADDRESS AND
# SYMBOL NAME
#
    
print "Parsing dynamic relocation table"
for line in filelines:
    match = re.search('^([\da-fA-FxX]+)\s+\S+\s+(\S+)$', line)
    if not match:   continue
    
    gotaddr = int(match.group(1),16) # conv hex->dec
    name = match.group(2)
#
# DEAL WITH MANGLED NAMES
#
    # Check if we can use as demangler and setup pipes now:
    p = os.popen(cppfilt+" -p "+name,'r')
    if p:
        name = p.read().strip()
        # retain full name:
        name = re.subn("[<>:,\s~`'?*]", "_", name)[0]
        print name
#
# MAP .got ADDRESS TO .plt JUMP TABLE
# AND THEN RENAME .plt JUMP TO name
#
    for pltaddr in DataRefsTo(gotaddr):
        MakeNameEx(pltaddr, name, SN_AUTO)
        print ".got %08X ->.plt %08X: %s" % (gotaddr, pltaddr, name)

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