六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 90|回复: 0

把MAP文件导入IDA Pro的小程序

[复制链接]

升级  69.5%

780

主题

780

主题

780

主题

探花

Rank: 6Rank: 6

积分
2390
 楼主| 发表于 2013-1-15 02:01:47 | 显示全部楼层 |阅读模式
IDA Pro是玩逆向工程必不可少的工具,但是很遗憾IDAPro好像不支持直接导入map文件(如果有谁知道可以,请告诉我)。前几天分析一个程序,很奇怪提供了MAP却没提供PDB。不悦,顺手写了一段把map文件转换成IDA Pro的idc脚本的Python小程序:
<div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#-*-coding:utf-8-*-
from__future__importwith_statement
importsys
importos

defmap2idc(in_file,out_file):
withopen(out_file,
'w')asfout:
fout.write(
'#include<idc.idc>\n')
fout.write(
'staticmain()\n{\n')
withopen(in_file)asfin:
forlineinfin:
list
=line.split()
iflen(list)>=3andlen(str(list[2]))==8andstr(list[2]).isalnum():
fout.write(
'\tMakeName(0x%s,"%s");\n'%(list[2],list[1]))
fout.write(
'}\n')

defmain():
fromoptparseimportOptionParser
parser
=OptionParser(usage='usage:%prog<mapfilename>')
(options,args)
=parser.parse_args()
iflen(args)<1:
parser.error(
'incorrectnumberofarguments')
returnmap2idc(args[0],os.path.splitext(args[0])[0]+'.idc')

if__name__=="__main__":
sys.exit(main())
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表