Created
December 15, 2011 11:49
-
-
Save dketov/1480835 to your computer and use it in GitHub Desktop.
Протокол Telnet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
""" | |
Получение списка файлов в домашнем каталоге | |
""" | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment