首页
社区
课程
招聘
未解决 [求助]Windows 内存加载问题疑问 50.00雪花
发表于: 2022-1-2 21:33 6717

未解决 [求助]Windows 内存加载问题疑问 50.00雪花

2022-1-2 21:33
6717

主要想保密自己代码 加密自己dll, 然后读取解密 搞内存加载,就是自己实现loadlibrary 然后自己getprocessaddress 自己的函数

 

但是有问题就是 如果自己程序使用了额外的库,比如openssl等内存加载就出问题,库用不了,比如用openssl的rsa加密直接就用不了,报错。编译用的MT。
但是如果调用系统的loadlibrary就没问题,想问下是自己写loadlibrary哪一部份出问题 内存加载我直接搞的fancycode-MemoryModule github上的。如果能解决最好直接提供代码。

 

loadlibrary 地址https://github.com/fancycode/MemoryModule

 

例子随便网上找的, 用loadlibrary系统的没问题。

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
44
45
46
47
48
49
50
51
52
#include "stdafx.h"
#include <openssl/evp.h> 
#include <openssl/bio.h> 
#include <openssl/buffer.h>   
#include <string> 
#include <iostream>
#include <winsock2.h>
using namespace std;
 
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "libcrypto64MT.lib")
#pragma comment(lib, "crypt32.lib")
 
 
char * base64Encode(const char *buffer, int length, bool newLine);
 
extern "C" __declspec(dllexport) void test()
{
    bool newLine = false;
    string input = "Hello World!";
 
    char * encode = base64Encode(input.c_str(), input.length(), newLine);
 
    cout << "Base64 Encoded : " << encode << endl;
 
    cin.get();
}
 
char * base64Encode(const char *buffer, int length, bool newLine)
{
    BIO *bmem = NULL;
    BIO *b64 = NULL;
    BUF_MEM *bptr;
 
    b64 = BIO_new(BIO_f_base64());
    if (!newLine) {
        BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
    }
    bmem = BIO_new(BIO_s_mem());
    b64 = BIO_push(b64, bmem);
    BIO_write(b64, buffer, length);
    BIO_flush(b64);
    BIO_get_mem_ptr(b64, &bptr);
    BIO_set_close(b64, BIO_NOCLOSE);
 
    char *buff = (char *)malloc(bptr->length + 1);
    memcpy(buff, bptr->data, bptr->length);
    buff[bptr->length] = 0;
    BIO_free_all(b64);
 
    return buff;
}

[课程]Linux pwn 探索篇!

最后于 2022-1-3 14:26 被ttrx编辑 ,原因:
收藏
免费 0
支持
分享
最新回复 (6)
雪    币: 22411
活跃值: (25334)
能力值: ( LV15,RANK:910 )
在线值:
发帖
回帖
粉丝
2
可是你写的LoadLibrary没发出来。。别人要怎么知道问题在哪。。
2022-1-3 11:12
0
雪    币: 200
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
3
嗯 我贴下代码地址 还有例子稍等
2022-1-3 14:21
0
雪    币: 2623
活跃值: (6336)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
能静态编译就用静态编译这样可以避免不必要的dll依赖
2022-1-4 13:12
0
雪    币: 2998
活跃值: (2664)
能力值: ( LV2,RANK:15 )
在线值:
发帖
回帖
粉丝
5

1

最后于 2022-1-4 14:33 被 .编辑 ,原因:
2022-1-4 14:01
0
雪    币: 200
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
6
用的就是静态编译 ,反而不是静态编译可以,额外带dll就可以 ,我今天试了openssl3.0 有的函数可以有的就不行,之前用的1.1.1直接都不行
2022-1-4 19:36
0
雪    币: 1555
活跃值: (3032)
能力值: ( LV11,RANK:180 )
在线值:
发帖
回帖
粉丝
7
reflective dll 不行吗
2022-1-4 22:21
0
游客
登录 | 注册 方可回帖
返回
//