IDA memory dump

0x00 前言

这几天有个需求,要用ida dump内存,我的是ida7.7,在吾爱破解上下载的。百度了一下,发现网上的都用不了,然后整理了一下,供大家使用

0x01 IDC脚本

ida中,按 Shift+F2,输入以下代码,记得修改路径fname

auto fname      = "e:\\dump_mem.bin";
auto address    = 0x233D0140000;
auto size       = 0x16f510;
auto file= fopen(fname, "wb");

savefile(file, 0, address, size);
fclose(file);

在这里插入图片描述

0x02 Python脚本

基于 https://github.com/qgy123/IDAMemoryDumper 修改了一个小bug

将下面的脚本拷贝到ida中的plugins目录下,然后重启ida,输入快捷键Ctrl-Alt-M

import ida_kernwin
import idaapi
import idc

act_name = "memdumper:opendump"
label = "Memory dumper"


class MemDumper_t(idaapi.plugin_t):
    flags = idaapi.PLUGIN_PROC
    comment = "MemDumper"
    help = "A plugin to dump the memory region where you wannted from the debugger"
    wanted_name = label
    wanted_hotkey = "Ctrl-Alt-M"

    def init(self):
        self.hextays_inited = False

        print("Memory Dumper (v1.0) by yueluo")
        print("Plugin has been loaded.")

        self.hexrays_inited = True
        return idaapi.PLUGIN_KEEP

    def run(self, arg):
        s = """Memory Dumper

        Enter the memory region:
        
        begin:  <:n::12::>
        
        size:   <:n::12::> (optional, fill it to ignore the end address)        
        or        
        end:    <:n::12::>
        """

        currea = idaapi.get_screen_ea()
        begin = idaapi.Form.NumericArgument('N', currea)
        size = idaapi.Form.NumericArgument('N', 0x0)
        end = idaapi.Form.NumericArgument('N', 0x0)

        ok = idaapi.ask_form(s,
                             begin.arg,
                             size.arg,
                             end.arg)
        if ok == 1:
            print("Begin dump")

            if size.value == 0:
                if end.value <= begin.value:
                    idaapi.warning("Incorrect Address!")
                    return
                else:
                    dumpsize = end.value - begin.value

            else:
                dumpsize = size.value

            print("begin: 0x%x, end: 0x%x" % (begin.value, begin.value + dumpsize))

            path = ida_kernwin.ask_file(True, "*", "Save dump to?")

            if not path:
                return

            print("path: %s" %path)

            if idc.savefile(path, 0, begin.value, dumpsize) != 0:
                idaapi.info("Save successed!")
            else:
                idaapi.warning("Failed to save dump file!")

    def term(self):
        if self.hexrays_inited:
            idaapi.term_hexrays_plugin()


def PLUGIN_ENTRY():
    return MemDumper_t()

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: IDA Python是IDA中一个强大的功能,可以通过编写Python脚本来扩展IDA的功能。安装IDA Python的步骤如下:首先,根据自己的IDA版本和Python版本,下载对应的IDAPython包。然后,将IDAPython解压后的Python文件夹内的所有内容覆盖掉IDA原有的Python文件夹。接下来,将IDAPython解压后的Plugins文件夹中的python.plw和python.p64拷贝到IDA原有的Plugins文件夹中。最后,将IDAPython解压后的python.cfg文件拷贝到IDA原有的cfg文件夹中。如果python2.7安装包中没有python27.dll,可以将python26.dll重命名为python27.dll,并确保python的系统位数与IDAPython的系统位数相同。安装完成后,可以通过编写IDA Python脚本来扩展IDA的功能。IDA Python文档提供了相关函数的详细说明,可以在官方网站上获取相关文档。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [IDA 配置python环境,可执行python脚本](https://blog.csdn.net/ayxh0058/article/details/101094191)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [ida使用技巧:ida python](https://blog.csdn.net/m0_52164435/article/details/124878537)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值