0%

免杀

免杀

C

字符串隐藏

在静态免杀中,如果字符串使用const char* str = "Hello World";方式,或者放在全局变量区初始化,会在文件中直接看到

image-20240921192249823

对免杀要隐藏字符串,使用char str[] = {'h', 'e', 'l', 'l', 'o', 0};初始化的字符串不会编译到文件里面,只有在程序开始运行的时候才会加载到栈中。

但是这种方法在exe中使用release版本编译还是可能被系统优化成一段完整的字符串,因此可以加入一些混淆代码,比如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int mian(void)
{
int a[6] = { 0 };
int b[5] = { 0 };
a[0] = 'h';
b[0] = 'a';
a[1] = 'e';
b[1] = 'f';
a[2] = 'l';
b[2] = 'r';
a[3] = 'l';
b[3] = 'p';
a[4] = 'o';
}

这样打印数组a就是hello,并且使用release生成也不会显示在PE文件中。

命令行参数

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
#include <windows.h>

int main(int argc, char* argv[])
{
printf("argc = %d\n", argc);
// 循环打印argv数组中的内容
for (int i = 0; i < argc; i++)
{
printf("argv[%d] = %s\n", i, argv[i]);
}
return 0;
}
image-20240921194356442

argc是输入的参数的个数加一,第一个参数是当前进程名,如果是在cmd中执行这个exe:

image-20240921194554141