my_nihilist has asked for the wisdom of the Perl Monks concerning the following question:
NOTE: THCB does not yet log you out because you can't log out through telnet. You can log in repeatedly, but i recommend against this; eventually im2 sends little scoldings back.#!/usr/bin/perl use warnings; use strict; use Term::ANSIColor; use IO::Handle; use IPC::Open2; $|=1; print "User: "; my $User=<>; print "Pass: "; my $Pass=<>; open2(*TNIN, *TNOUT, "telnet desert-island.dynodns.net 4040"); TNOUT->autoflush(1); open(LOG, ">THCB.log"); LOG->autoflush(1); print TNOUT "auth ]$User [ $Pass"; my @c=("red","green","yellow","magenta"); my $n=0; alarm 120; my $m=2; while (<TNIN>) { $SIG{ALRM}=sub{rearm()}; print LOG "$_"; if ($_ eq "Found you!\n") {print TNOUT "<i>exhaling...</i>\n"} my @line = split / /; my $bit = shift @line; chomp @line; if ($bit =~ /:$/) { print color("blue on_cyan"), "$bit"; print color("reset"); } else {print color("$c[$n]"), "$bit "} print color("$c[$n]"), "@line "; if ($n eq 3) {$n=0} else {$n++} } sub rearm { print color("white on_red"), "$m"; print "m"; print color("reset"); alarm 120; $m++; $m++; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: bidirectional challange
by ikegami (Patriarch) on Mar 13, 2008 at 22:26 UTC | |
by ikegami (Patriarch) on Mar 14, 2008 at 04:30 UTC | |
Re: bidirectional challange
by halfcountplus (Hermit) on Mar 14, 2008 at 03:48 UTC | |
Re: bidirectional challange
by my_nihilist (Sexton) on Mar 14, 2008 at 14:25 UTC |