test_virus.c

来自「代码给出了Linux系统下蠕虫代码如何通过有漏洞的系统进行蔓延的。」· C语言 代码 · 共 37 行

C
37
字号
/* Simple file opening and closing program
* to test Vscr2 virus spread to another machine
*
* If a file does not exist, it will create it.
*  
* This program should be compiled after the virus
* has been executed on the system.
* When it is compiled, the functions from the corrupted
* stdio.h will be pasted into the code.
*
* Then, once the compiled version is run on another 
* machine, it will infect that machine.
*
* Georgia Tech, Spring 2003
*/

#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <linux/unistd.h>
#include <fcntl.h>



int fd;
char *name = "testfile";

int main(void)
{
	fd = creat(name, 0666); /* create the file */
	printf("Opened testfile!\n");
	close(fd); /* close the file */
	printf("Closed testfile!\nThis system should be infected now!\n");
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?