首页
社区
课程
招聘
[原创] 发点好玩的东西,但是没源码
2023-4-22 17:21 16104

[原创] 发点好玩的东西,但是没源码

2023-4-22 17:21
16104
struct struobf_test
{
	int a1;
	float a2;
	UINT64 a3;
	int a4;
	int a5;
	int a6;
}OBF_STRUCT;

class CTestClass : public ITestClass
{
public:
	CTestClass()
	{
		DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "ctor\n");
	}

	virtual ~CTestClass() override
	{
		DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "dtor\n");
	}

	virtual void testfn() override;

private:
	struct struobf_test test;
};

void CTestClass::testfn()
{
	test.a4 = 666;
	DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "testfn4, a1=%d, a2=%f, a3=%p, a4=%d, offset_a1=%d, offset_a2=%d, offset_a3=%d, offset_a4=%d\n", 
		test.a1, test.a2, test.a3, test.a4, offsetof(struobf_test, a1), offsetof(struobf_test, a2), offsetof(struobf_test, a3), offsetof(struobf_test, a4));
}

//第一次编译

//第二次编译

优点:不用生成中间文件


缺点:暂时没发现


听说某常年网吧热度第一的游戏很久以前就在用了


感谢某大佬的大力兹磁


实现比较丑陋,这里就不发出来了


//2023-04-23 更新

class CTestClass : public ITestClass
{
public:
	CTestClass()
	{
		DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "ctor\n");
	}
	~CTestClass()
	{
		DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "dtor\n");
	}

	virtual void testfn1() override;
	virtual void testfn2() override;
	virtual void testfn3() override;
	virtual void testfn4() override;

private:
	struct struobf_test test;
};
extern "C" NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryString) OBF_FUNCTION
{
	UNREFERENCED_PARAMETER(RegistryString);

	ITestClass *ptest = new CTestClass;

	ptest->testfn1();
	ptest->testfn2();
	ptest->testfn3();
	ptest->testfn4();

	delete ptest;

	return STATUS_SUCCESS;
}




[培训]二进制漏洞攻防(第3期);满10人开班;模糊测试与工具使用二次开发;网络协议漏洞挖掘;Linux内核漏洞挖掘与利用;AOSP漏洞挖掘与利用;代码审计。

最后于 2023-4-23 18:06 被hzqst编辑 ,原因:
收藏
点赞4
打赏
分享
最新回复 (21)
雪    币: 2448
活跃值: (1575)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
maxwudi 2023-4-22 18:25
2
0
前排瓜子板凳
雪    币: 9550
活跃值: (4458)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
lononan 2023-4-22 22:22
3
0
牛逼哦,打乱起构体
雪    币: 10
活跃值: (112)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
jzwooioi 2023-4-22 22:30
4
0
6
雪    币: 2338
活跃值: (1643)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
天月 2023-4-23 07:59
5
0
大表哥!
雪    币: 2251
活跃值: (2148)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
LexSafe 2023-4-23 08:36
6
0
哈哈 你也玩原神啊
雪    币: 333
活跃值: (970)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
fatcateatrat 2023-4-23 09:18
7
0
LexSafe 哈哈 你也玩原神啊[em_43]
不应该是lol吗
雪    币: 12839
活跃值: (8998)
能力值: ( LV9,RANK:280 )
在线值:
发帖
回帖
粉丝
hzqst 3 2023-4-23 09:44
8
0

最后于 2023-4-23 09:44 被hzqst编辑 ,原因:
雪    币: 59
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
wx_man_611 2023-4-23 10:12
9
0
不懂,求问原理是啥,为啥编译的不一样了?
雪    币: 227
活跃值: (418)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
hatling 3 2023-4-23 13:28
10
1
用gcc ,加个这个宏就行了
/* This anon struct can add padding, so only enable it under randstruct. */
#define randomized_struct_fields_start        struct {
#define randomized_struct_fields_end        } __randomize_layout;
#endif
雪    币: 307
活跃值: (4089)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
pysafe 2023-4-23 18:13
11
0

雪    币: 12839
活跃值: (8998)
能力值: ( LV9,RANK:280 )
在线值:
发帖
回帖
粉丝
hzqst 3 2023-4-23 20:42
12
0
hatling 用gcc ,加个这个宏就行了 /* This anon struct can add padding, so only enable it under randstruct. */ #define ...
大哥牛逼,查了下居然clang12开始原生支持了
雪    币: 3733
活跃值: (3743)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
Mxixihaha 2023-4-24 14:14
13
0
这还不如定义几个常量直接.

比如 #define  X  10

在结构体中穿插    unsigned char xxx[X];

这样结构体就被分开了,起码 比这个对齐式的穿插要随机间隔大得多.
雪    币: 477
活跃值: (1412)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
mb_foyotena 2023-4-24 14:21
14
0
黄狗v5
雪    币: 481
活跃值: (1736)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
Istaroth 2023-4-24 15:02
15
0

.

最后于 2023-10-21 21:49 被Istaroth编辑 ,原因:
雪    币: 8094
活跃值: (5280)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
mudebug 2023-4-24 15:24
16
0

雪    币: 6124
活跃值: (4121)
能力值: ( LV6,RANK:80 )
在线值:
发帖
回帖
粉丝
黑洛 1 2023-4-27 06:57
17
1
学微软弄个几百个成员的大结构,打乱 都可以打乱。
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
milke 2023-5-26 17:31
18
0
llvm是个好东西
雪    币: 20
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
milke 2023-5-26 17:32
19
0
可以尝试编译时随机增加pad,更有迷惑性
雪    币: 72
活跃值: (128)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
我叫莫妮卡 2023-11-13 11:42
20
0
黄狗是我偶像
雪    币: 777
活跃值: (1066)
能力值: ( LV5,RANK:78 )
在线值:
发帖
回帖
粉丝
bambooqj 2023-11-13 14:29
21
0
黄狗是我偶像
雪    币: 3710
活跃值: (3924)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
caolinkai 2024-4-15 20:32
22
0
感谢  分享
游客
登录 | 注册 方可回帖
返回