Use a script to simulate a telnet client to do automation ;) see below is an python example. I added some timer to make sure every command fire correctly:
import getpass
import sys
import telnetlib
import time
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("ogin")
tn.write(user + "\n")
if password:
tn.read_until("assword")
tn.write(password + "\n")
tn.write("\n")
tn.write("ls\n")
time.sleep(1)
tn.write("exit\n")
time.sleep(1)
print tn.read_all()
import getpass
import sys
import telnetlib
import time
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("ogin")
tn.write(user + "\n")
if password:
tn.read_until("assword")
tn.write(password + "\n")
tn.write("\n")
tn.write("ls\n")
time.sleep(1)
tn.write("exit\n")
time.sleep(1)
print tn.read_all()