首页
社区
课程
招聘
[分享]一个方便的任意函数调用库
发表于: 2022-3-11 20:55 6416

[分享]一个方便的任意函数调用库

2022-3-11 20:55
6416

在DLL注入到某软件后,我们往往想直接调用软件的功能,但是每次都要自己去构造汇编代码call的话实在是太麻烦了,我在网上无意中发现了一个写好的库,项目地址如下:
406K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1k6V1j5h3&6A6k6h3I4C8M7Y4g2H3K9h3&6K6K9$3W2Q4x3V1k6^5z5o6k6d9k6i4c8e0M7r3!0G2k6R3`.`.

 

测试用例如下:

1
2
3
4
5
6
7
8
9
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
#include <windows.h>
#include <stdio.h>
#include <string>
#include "x86RetSpoof.h"
 
 
int __stdcall stdCallFunction(int a, std::string b)
{
    printf("执行%s\n", b.c_str());
    return 111;
}
 
int _cdecl cdeclFunction(int a, std::string b)
{
    printf("执行%s\n", b.c_str());
    return 222;
}
 
int __fastcall fastCallFunction(int a, int b, std::string c)
{
    printf("执行%s,%d,%d\n", c.c_str(), a, b);
    return 333;
}
 
int main() {
 
    while (1) {
        auto f = GetProcAddress(LoadLibraryA("user32.dll"), "MessageBoxA");
        //x86RetSpoof::invokeStdcall<int>(std::uintptr_t(f), 0, "123", "456", 0);
 
        std::string str = "stdcall";
        x86RetSpoof::invokeStdcall<int>(std::uintptr_t(stdCallFunction), 0, str);
 
        str = "cdelc";
        x86RetSpoof::invokeCdecl<int>(std::uintptr_t(cdeclFunction), 0, str);
 
        str = "fastcall";
        x86RetSpoof::invokeFastcall<int>(555,666,std::uintptr_t(fastCallFunction),str);
 
    }
 
    return 0;
}

这样去调用函数就舒服多了


[培训]科锐逆向工程师培训第53期2025年7月8日开班!

最后于 2022-3-11 21:01 被fjqisba编辑 ,原因:
上传的附件:
收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 7826
活跃值: (4672)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
https://bbs.pediy.com/thread-255168.htm
2022-3-11 22:02
0
雪    币: 102
活跃值: (2785)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
3
mark
2022-3-11 23:07
0
雪    币: 7722
活跃值: (4817)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
GOOD 。。
2022-3-12 09:44
0
雪    币: 13492
活跃值: (6904)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
5
声明变参函数能解决的事却拐弯抹角伪造返回地址,是何居心
2022-3-12 09:52
0
游客
登录 | 注册 方可回帖
返回