生成逆向调试符号的几款工具

本文详细介绍了调试符号的定义,包括不同格式如SYM、COFF、CodeView、PDB和DBG,以及如何通过工具如dumpbin、Flirt和IDR生成和使用这些符号。重点展示了PDB格式的广泛使用及其在现代开发中的重要性。

逆向调试符号

定义

调试符号是被调试程序的二进制信息与源程序信息之间的桥梁,是在编译器将源文件编译为可执行程序的过程中为支持调试而摘录的调试信息。调试信息包括变量、类型、函数名、源代码行等。


格式分类

1.SYM格式

SYM格式早期用于 MS-DOS 和 16位Windows系统,现在只作为Windows9x的调试符使用(因为Windows9x系统的多数内核仍然是16位的)


2.COFF格式

COFF格式(Common Object File Format)是UNIX供应商所遵循规范的一部分,由WindowsNT2.1首次引进使用。现在,微软逐渐抛弃了COFF格式,转而使用更为流行的符号表达式。


3.CodeView格式

CodeView(CV)最早是在MS-DOS下作为Microsoft C/C++ 7的一部分出现的,现在已经支持Win32系统了。“CodeView”是早期微软调试器的名次,其支持的调试符号为C7格式。C7格式在执行模块中是自我包含的,符号信息与二进制代码混合(意味着调试方式会非常大)


4.PDB格式

PDB(Program Database)格式是现今最常用的一种符号形式,是微软自己定义的未公开格式。Visual C++和 Visual Basic 都支持PDB格式。与“CV”不同的是,PDB符号根据应用程序不同的链接方式保存在单独的或多个文件中。


5.DBG格式

DBG是系统调试符。有了系统调试符,调试器才可以显示系统函数名。DBG文件与其他符号格式不同,因为链接器并不创建DBG文件。DBG文件基本上是一个包含其他调试符的文件(例如包含COFF或C7等类型的调试符)微软将操作系统调试符分配在DBG文件中。当然,这些文件中只包含公用信息和全局信息,例如ntdll.dbg、kernel32.dbg等。


6.MAP文件

MAP文件是程序的全局符号、源文件和代码行号信息的唯一文本表示方式。MAP文件在任何地方、任何时候都可以使用,不需要程序支持,通透性极好。


生成调试符号的工具

1.Dumpbin

介绍

dumpbin.exe在VS的VC目录下,通过dumpbin命令来获取dll文件或者lib文件里面包含的函数

请添加图片描述


使用方法

  • 导出dll文件里的函数:dumpbin.exe /exports xxx.dll /out xxx.txt
  • 导出lib文件里的函数:dumpbin.exe /exports xxx.lib /out xxx.txt

2.Flirt

介绍

利用flirt工具针对lib文件生成对应的sig文件,然后导入ida中可以自动识别出函数名,ida导入sig文件后生成对应的map文件可导入OD中识别函数名,实现“动静结合”的调试方式


使用方法

进入flirt文件夹目录,找到如下图所示的两个可执行文件

请添加图片描述


执行以下命令生成对应的sig文件

pcf.exe xxx.lib xxx.pat  //创建模式文件(pat文件)
sigmake.exe xxx.pat xxx.sig  //创建签名文件(sig文件)

将sig文件拖入ida目录下的sig文件夹

请添加图片描述


打开ida导入对应的sig文件

请添加图片描述


利用ida生成map文件,随后将map导入od

请添加图片描述

请添加图片描述


3.IDR

介绍

IDR用于生成逆向delphi语言的调试符号, 可以准确获取各种事件的位置, 也可以生成map配合OD进行分析


使用方法

打开IDR,将delphi编写的程序拖入IDR中,然后IDR会加载一段时间

请添加图片描述


切换到forms,并且勾选上form,下面三行字代表程序的各种事件

请添加图片描述


如下图所示,edit表示编辑框,bitbtn表示按钮,右边的窗口界面记录着对应事件的汇编代码

请添加图片描述


利用IDR生成delphi语言的map,随后可导入OD进行动态分析

请添加图片描述

News 26.03.2015 Knowledge base file for Delphi XE3 freely available. 23.03.2015 Knowledge base file for Delphi XE and Delphi XE2 freely available. 16.03.2015 Latest version is available for download. What is IDR? IDR (Interactive Delphi Reconstructor) – a decompiler of executable files (EXE) and dynamic libraries (DLL), written in Delphi and executed in Windows32 environment. The program firstly is intended for the companies, engaged by development of anti-virus software. It can also help programmers to recover lost source code of programs appreciably. The current version of the program can process files (GUI and console applications), compiled by Delphi compilers of versions Delphi2 – Delphi XE3. Final project goal is development of the program capable to restore the most part of initial Delphi source codes from the compiled file but IDR, as well as others Delphi decompilers, cannot do it yet. Nevertheless, IDR is in a status considerably to facilitate such process. In comparison with other well known Delphi decompilers the result of IDR analysis has the greatest completeness and reliability. Moreover interactivity does work with the program comfortable and (we shall not be afraid of this word) pleasant. IDR make static analysis (analyzed file is not loaded to memory and executed) that allows to safely investigate viruses, trojans and other malware applications, those which executing is dangerous or is not desirable. The program does not require any installation activity and does not do any records in Windows registry. Below screenshot of IDR main window is shown. You can find examples of IDR working results on separate page. For detailed acquaintance with opportunities IDR there is a help file in format CHM which can be downloaded on page of download or directly from this link.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值