#!/usr/bin/perl use Socket; # no its a quicky, i didnt use strict..its hard to write # code in this text box $HOSTNAME = "hostname.of.router"; $TELNETTO = "where.to.telnet.to.from.hostname"; $USER = "username"; $PASS = "password"; while (1) { socket(SOCK,PF_INET,SOCK_STREAM,getprotobyname('tcp')); connect(SOCK, sockaddr_in(23,inet_aton("$HOSTNAME"))); select(SOCK); $|=1; select('stdout'); print SOCK "$USER\n"; while() { ($stuff) = split(/\s+$/,$_); if ($stuff =~ /Password:/) { print SOCK "$PASS\n"; } if ($stuff =~ /\>$/) { # we have user access print SOCK "telnet $TELNETTO"; # do some matching on its prompt } } exit; }