The telnetlib module

This module provides a TELNET client implementation.

The following example connects to a Unix computer, logs in, and retrieves a directory listing.

Example: Using the telnetlib module to login on a remote server
# File:

import telnetlib
import sys

HOST = "spam.egg"

USER = "mulder"
PASSWORD = "trustno1"

telnet = telnetlib.Telnet(HOST)

telnet.read_until("login: ")
telnet.write(USER + "\n")

telnet.read_until("Password: ")
telnet.write(PASSWORD + "\n")

telnet.write("ls librarybook\n")

print telnet.read_all()

[spam.egg mulder]$ ls

A Django site. rendered by a django application. hosted by webfaction.