--- smtpscan 2003-05-06 00:49:07.000000000 +0200 +++ smtpscannew 2007-03-05 13:00:56.000000000 +0100 @@ -18,7 +18,7 @@ use vars qw /$VERSION $LOCAL_SHARE $INVA $help $fgp_file $test_file @remote_hosts $remote_port $timeout $verbose $debug $remote_ip $domain $mx_priority $connect_once @fingerprints %fingerprints @tests $nb_tests $nb_fingerprints - $every_mxs $version $banner $try @VALID_CHARS %printed/; + $every_mxs $version $banner $try $wait @VALID_CHARS %printed/; Getopt::Long::Configure("no_ignore_case"); @@ -34,7 +34,7 @@ my $mail_user = ''; $LOCAL_SHARE = '/usr/local/share'; -$VERSION = '@VERSION@'; +$VERSION = '0.5'; @VALID_CHARS = ( 'A' .. 'Z', 'a' .. 'z', '0' .. '9', '_'); @@ -59,13 +59,13 @@ GetOptions('h' => \$help, 'c' => \$connect_once, 'a' => \$every_mxs, 'V' => \$version, + 'w=s' => \$wait, ); $fgp_file ||= "$LOCAL_SHARE/smtpscan/fingerprints"; $test_file ||= "$LOCAL_SHARE/smtpscan/tests"; $remote_port ||= 25; $timeout ||= 10; - if ($help) { my $basename = basename $0; @@ -225,6 +225,7 @@ sub scan { } else { ($sock, $banner) = smtp_connect($remote_ip, $remote_port, $timeout); + sleep $wait if($wait); } foreach my $command (@commands) { @@ -234,6 +235,7 @@ sub scan { push @result, $error_code; close $sock unless ($connect_once); + sleep $wait if ($wait); print $verbose ? "\n" : ("\b" x (4 + (++$try / 10 ))) . "$try/$nb_tests"; } @@ -336,7 +338,6 @@ sub send_command { local $SIG{'ALRM'} = sub { die "Timeout\n"; }; alarm $timeout; syswrite($sock, $command, length($command)); - $buf = get_lines($sock); alarm 0; @@ -351,7 +352,6 @@ sub send_command { sub get_lines { my $sock = shift; my ($buf, $line); - do { $line = get_line($sock); $buf .= $line; @@ -400,9 +400,7 @@ sub smtp_connect { }; die "Time out when getting banner (perhaps you should increase it with -i switch?)\n" if $@; - $sock->autoflush(); - return ($sock, $banner); }