sg has asked for the wisdom of the Perl Monks concerning the following question:
However, both outputs look alike (except for the leading tag)!
What exactly needs to be done in the user-code so that the output would explicitly show ssl'ish things happening in one case and non-ssl'ish things happening in the other case? For example, how would one print out the messages being exchanged by the local machine and the pop server and show that in one case the messages are in plain text and in the other case the messages are ssl-encrypted?
#!/use/bin/perl BEGIN {(*STDERR = *STDOUT) || die;} use diagnostics; use warnings; use strict; $| = 1; { package Net::POP3::SSL; # $Id: SSL.pm,v 1.1 2004/07/20 03:22:18 cwest Exp $ use strict; use vars qw[$VERSION @ISA]; $VERSION = sprintf "%d.%02d", split m/\./, (qw$Revision: 1.1 $)[1]; use IO::Socket::SSL; use Net::POP3; @ISA = ( 'IO::Socket::SSL', grep { $_ ne 'IO::Socket::INET' } @Net::POP3::ISA ); no strict 'refs'; foreach ( keys %Net::POP3:: ) { next unless defined *{$Net::POP3::{$_}}{CODE}; *{$_} = \&{"Net::POP3::$_"}; } 1; } my $pop_host = '<pop.host>'; my $pop_port = 995; my $user_id = '<user_id>'; my $password = '<password>'; my %pop_options = ( Host => $pop_host, LocalPort => $pop_port, #ResvPort => 1, # Timeout => 30, Debug => 4, ); my %pop_ssl_options = ( Host => $pop_host, Port => $pop_port, #ResvPort => 1, # Timeout => 30, Debug => 4, ); test_pop(); sub test_pop { my $mail =''; if(!($mail = Net::POP3::SSL->new(%pop_ssl_options))) #if(!($mail = Net::POP3->new(%pop_options))) { print "ERROR: Could not open $pop_host\n$!\n"; return -1; } my $number_of_messages = $mail->login($user_id, $password); if(!$number_of_messages) { (defined $number_of_messages) or print "ERROR: Login error for +$pop_host\n$!\n"; $mail->quit(); return -1; } print "Number of messages: $number_of_messages\n"; } __END__ Output: Net::POP3>>> Net::POP3(2.29) Net::POP3>>> Net::Cmd(2.29) Net::POP3>>> Exporter(5.60) Net::POP3>>> IO::Socket::INET(1.31) Net::POP3>>> IO::Socket(1.30) Net::POP3>>> IO::Handle(1.27) Net::POP3=GLOB(0x1d699cc)<<< +OK hello from popgate on pop104.plus.mai +l.stuff.com 2.38.1 Net::POP3=GLOB(0x1d699cc)>>> USER <user_name> Net::POP3=GLOB(0x1d699cc)<<< +OK password required. Net::POP3=GLOB(0x1d699cc)>>> PASS .... Net::POP3=GLOB(0x1d699cc)<<< +OK maildrop ready, 452 messages (5836296 + octets) (6062525 3105357824) Number of messages: 452 Net::POP3::SSL>>> Net::POP3::SSL(1.01) Net::POP3::SSL>>> IO::Socket::SSL(1.08) Net::POP3::SSL>>> IO::Socket::INET(1.31) Net::POP3::SSL>>> IO::Socket(1.30) Net::POP3::SSL>>> IO::Handle(1.27) Net::POP3::SSL>>> Exporter(5.60) Net::POP3::SSL>>> Net::Cmd(2.29) Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK hello from popgate on pop106.plu +s.mail.stuff.com 2.38.1 Net::POP3::SSL=GLOB(0x1d69a0c)>>> USER <user_name> Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK password required. Net::POP3::SSL=GLOB(0x1d69a0c)>>> PASS .... Net::POP3::SSL=GLOB(0x1d69a0c)<<< +OK maildrop ready, 447 messages (58 +08500 octets) (6034729 3105357824) Number of messages: 447
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Peeking into a POP3-SSL exchange
by ikegami (Patriarch) on Sep 06, 2007 at 04:36 UTC | |
by Anonymous Monk on Sep 21, 2007 at 18:42 UTC | |
by ikegami (Patriarch) on Sep 22, 2007 at 04:03 UTC | |
by Anonymous Monk on Sep 24, 2007 at 16:03 UTC |