02-09-2018 12:19 AM - last edited on 02-14-2018 07:48 AM by jason_cmgr
Trying to telnet to a Brocade router and the python script is sending out error.... Not sure what is wrong here. Have tried a debug but cant make it working. I believe it's prompt issue. I appreciate if anyone has suggestion how to get it work.
Note: This is Python 3.0
import getpass import sys import telnetlib HOST = "18.104.22.168" user = "admin" password = "password" port = "23" telnet = telnetlib.Telnet(HOST) telnet.read_until("sw0 login:,3") telnet.write(admin + "\r") if password: telnet.read_until("Password: ") telnet.write(password + "\n") tn.write("term len 0" + "\n") telnet.write("sh ver br\n") telnet.write("exit\n") ERROR: Traceback (most recent call last): File "C:\Users\milan\Desktop\telnetNew.py", line 13, in <module> telnet.read_until("Username :,3") File "C:\Python33\lib\telnetlib.py", line 299, in read_until return self._read_until_with_select(match, timeout) File "C:\Python33\lib\telnetlib.py", line 352, in _read_until_with_select i = self.cookedq.find(match) TypeError: Type str doesn't support the buffer API This is my prompt after logging manually using telnet port 23 and this is what i expected command to work. _________________________________________________________________________________ Network OS (sw0) xxxxxxxxxx sw0 login: xxxxx Password: xxxxx WARNING: The default password of 'admin' and 'user' accounts have not been changed. Welcome to the Brocade Network Operating System Software admin connected from 10.100.131.18 using console on sw0 sw0# sh ver sw0# python-3.x share
"edited removed links - Community Manager - released from quarantine "