把MAP檔案匯入IDA Pro的小程式

來源:互聯網
上載者:User

IDA Pro是玩逆向工程必不可少的工具,但是很遺憾IDA Pro好像不支援直接匯入map檔案(如果有誰知道可以,請告訴我)。前幾天分析一個程式,很奇怪提供了MAP卻沒提供PDB。不悅,順手寫了一段把map檔案轉換成IDA Pro的idc指令碼的Python小程式:

# -*- coding:utf-8 -*-
from __future__ import with_statement
import sys
import os

def map2idc(in_file, out_file):
    with open(out_file, 'w') as fout:
        fout.write('#include <idc.idc>\n')
        fout.write('static main()\n{\n')
        with open(in_file) as fin:
            for line in fin:
                list = line.split()
                if len(list) >= 3 and len(str(list[2])) == 8 and str(list[2]).isalnum():
                    fout.write('\tMakeName(0x%s, "%s");\n' % (list[2], list[1]))
        fout.write('}\n')

def main():
    from optparse import OptionParser
    parser = OptionParser(usage='usage: %prog <map filename>')
    (options, args) = parser.parse_args()
    if len(args) < 1:
        parser.error('incorrect number of arguments')
    return map2idc(args[0], os.path.splitext(args[0])[0]+'.idc')

if __name__=="__main__":
    sys.exit(main())

使用方法:

python map2idc.py /path/to/mapfile

在IDA Pro中,載入待剖析器後,File-->IDC file...,選產生的IDC檔案。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.