我一直在研究客户端挂钩并制作了一个简单的程序来使用 dll 注入进行操作
#include "stdafx.h"
typedef char greet_t[16];
greet_t greetings[] = {
"Hello",
"Hi",
"Ahoy",
"Alas",
"Hallo",
"Ola"
};
int greeter(char *name) {
printf_s("%s, %s!\n", greetings[rand() % ((int) sizeof(greetings) / (int) sizeof(greet_t))], name);
int rerun = strcmp("Gabriel", name);
if (!rerun) printf_s("Have a nice day!\n");
return rerun;
}
int main() {
char name[64];
do {
scanf_s("%s", name);
} while (greeter(name));
system("Pause");
return 0;
}
这个想法是绕过greeter函数,除了我找不到它的偏移量。用 IDA Pro 看它看起来好像函数逻辑被扔在代码中间,好像根本没有函数调用。
.text:004010B0 lea eax, [ebp+var_44]
.text:004010B3 push eax
.text:004010B4 push offset aS ; "%s" (outside greeter())
.text:004010B9 call sub_401050 ; calling scanf_s
.text:004010BE add esp, 8
.text:004010C1 lea eax, [ebp+var_44]
.text:004010C4 push eax
.text:004010C5 call esi ; rand
.text:004010C7 cdq
.text:004010C8 idiv edi
.text:004010CA shl edx, 4
.text:004010CD add edx, offset aHello ; "Hello"
.text:004010D3 push edx
.text:004010D4 push offset aSS ; "%s, %s!\n" (inside greeter())
.text:004010D9 call sub_401020 ; calling printf_s
读取字符串窗口,它说所有这些字符串都在 sub_401090 上被引用,但是这个偏移量似乎不是我正在寻找的偏移量。我在做什么/读错了什么?