吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4709|回复: 15
收起左侧

[原创] IDA脚本 把PE文件中的资源保存为文件

  [复制链接]
女萝岩 发表于 2020-4-1 01:10
本帖最后由 女萝岩 于 2020-4-1 14:15 编辑

在用IDA分析程序的过程中有时候会遇到WriteFile操作,此时就想把这个文件给保存起来。
writepe.png

PEFILE.png


我以前是用OD调试,等它把文件写完就拷贝出来。今天尝试了一下IDA脚本,感觉良好,一劳永逸了。

使用的时候需要自行修改file addstart  size这三个变量。

[C] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <idc.idc>
//创建的文件和当前idb文件在同目录下
static main()
{
         
        auto file ="hahahehe.bin";
         
        auto addstart=0x101511e0;
         
        auto size=0x327a8;
         
         
        auto hfile=openfile(file);
         
         
        writefile(hfile,addstart,size);
         
        return 1;
         
}
 
static openfile(file)
{
        auto hfile=fopen(file,"wb");
        if(hfile==0)
        {
                Message("create file failed\n");
                return hfile ;
        }
         
        return hfile;
}
 
 
static writefile(hfile,addstart,size)
{
        auto ret=savefile(hfile,0,addstart,size);
         
        if(ret==0)
        {
                Mesage("write file error\n");
                return 0;
        }
         
        Message("success!");
        return 1;
}


免费评分

参与人数 4吾爱币 +13 热心值 +4 收起 理由
wintermo + 1 + 1 谢谢@Thanks!
2317909768 + 3 + 1 用心讨论,共获提升!
Hmily + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
pwp + 2 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| 女萝岩 发表于 2020-4-1 13:45
thornfish 发表于 2020-4-1 09:48
这个如何集成进去呢

这个是ida脚本,自行修改file  addstart size这三个变量,保存为123.idc,然后用IDA打开一个idb文件,file script file 加载123.idc就行了。
涛之雨 发表于 2020-4-1 08:35
记得某些(大部分)安卓壳dump出来dex的时候是用的。。。
此外不知道是错觉还是啥。。。
总觉得py的快一点。。。。
pwp 发表于 2020-4-1 02:04
klbd 发表于 2020-4-1 08:07
谢谢分享。
头像被屏蔽
ishwei 发表于 2020-4-1 08:48
提示: 作者被禁止或删除 内容自动屏蔽
chen4321 发表于 2020-4-1 08:48
666,谢谢大佬分享
15295828305 发表于 2020-4-1 09:03
谢谢好兄弟
JerryLia 发表于 2020-4-1 09:06
感谢分享,下载看看!
铁狼 发表于 2020-4-1 09:19
这个二进制要自己转换吗?我的IDA没网速不知到
啥情况
thornfish 发表于 2020-4-1 09:48
这个如何集成进去呢
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-20 23:49

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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