(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/telnet-objects.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-telnetlib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-urlparse.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/genindex.html| ]]
|
Previous: 11.11.1 Telnet Objects Up: 11.11 telnetlib Next: 11.12 urlparse
11.11.2 Telnet Example
A simple example illustrating typical use:
import getpass
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
print tn.read_all()
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/telnet-objects.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-telnetlib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/module-urlparse.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/20/lib/genindex.html| ]]
|
Previous: 11.11.1 Telnet Objects Up: 11.11 telnetlib Next: 11.12 urlparse
See About this document... for information on suggesting changes.