I was using a simple script that was acting as a proxy and dumped
packets received/sent to/from yahoo from any client.
You will need some POE modules to use it.
I am attaching it, hope it helps you.
#!/usr/bin/perl
use strict;
use warnings;
use POE qw/Component::Server::TCP Component::Client::TCP Filter::Stream/;
our $client=undef;
our $server=undef;
$| = 1;
#start proxy server
POE::Component::Server::TCP->new(
Port => 5050,
ClientConnected => \&connected,
ClientInput => \&input,
ClientDisconnected => \&disconnected,
ClientFilter => POE::Filter::Stream->new(),
) or die "Server $!";
#connect to yahoo server
POE::Component::Client::TCP->new(
RemoteAddress => 'scs.msg.yahoo.com',
RemotePort => 5050,
ServerInput => \&srv_input,
Connected => \&srv_connected,
Disconnected => \&srv_disconnected,
Filter => POE::Filter::Stream->new(),
) or die "Client $!";
POE::Kernel->run();
sub srv_connected {
my ($heap,$session) = @_[HEAP,SESSION];
$server = $heap->{server};
print "Connected to server\n";
}
sub srv_disconnected {
print "Disconnected from server\n";
}
sub srv_input {
my $input_record = $_[ARG0];
print "SERVER \n Message:$input_record\n Dump:";
dump_package($input_record);
$client->put($input_record);
}
sub connected {
my ($heap,$session) = @_[HEAP,SESSION];
$client = $heap->{client};
}
sub input {
my ($heap,$session,$client_input) = @_[HEAP,SESSION,ARG0];
print "\nCLIENT \n Message:$client_input\n Dump:";
dump_package($client_input);
$server->put($client_input);
}
sub disconnected {
print "\n\nDisconnected\n\n";
}
=head2 dump_package
Dump messages received from the server and client. Yahoo fields separator is the coresponding ascii for those two codes 192 128, they are marked with <> inside the dump
<192 128>
=cut
sub dump_package {
my ($data) = @_;
foreach my $chr ( split('',$data) ) {
print " <" if ord($chr)==192;
print " " . ord($chr);
print "> " if ord($chr)==128;
}
print "\n ------------------------------------------------END--------------------------------------------------------- \n";
}