我用python编写了该程序,以使用用户:admin和密码:pass:通过23端口与支持telnet的设备连接。
import getpass import telnetlib HOST = '192.168.1.10' user = input("Enter your remote account: ") password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until(b"login: ") tn.write(user.encode('ascii') + b"\n") if password: tn.read_until(b"Password: ") tn.write(password.encode('ascii') + b"\n") tn.write(b"dir\n") tn.write(b"exit\n") print(tn.read_all().decode('ascii'))
但是我有这个输出,程序无法连接:输入您的远程帐户:admin警告:QtConsole不支持密码模式,您键入的文本将可见。通过
我做错了什么?请帮助
[我在python中制作了此程序,以使用23端口与支持telnet的设备连接,并使用user:admin和password:pass:import getpass import telnetlib HOST ='192.168.1.10'user = input(“ ...
我听不清您在说什么,但是如果要使用cmd或powershell进行连接,则可以使用子进程模块,只需将其导入,如果要运行cmd命令,则只需键入:
我正在使用Windows 8.1和python 3.7.3,在我看到的所有示例中,人们都使用ubuntu,centos和linux,但是我希望该程序在Windows上运行。我用间谍编写程序