问题描述
当我使用 paramiko 通过 ssh 运行命令并使用
读取输出时我在输出中得到以下字符:
Lab 8665-2>[K e[Ken[Kena[Kenab[K[4Denabl[K[5Denable[K[6Denable [K Lab 8665-2#[K [Kn[Kno[Kno [Kt[Kte[Kter[Kterm[K[4Dtermi[K[5Dtermin[K[6Dtermina[K[7Dterminal[K[8Dterminal [Km[Kmo[Kmor[Kmore[K[4Dmore [K Lab 8665-2#[K [Ks[Ksh[Ksho[Kshow[K[4Dshow [Ki[Kip[Kip [Ki[Kin[Kint[Kint [Kb[Kbr[Kbr [K Interface IP-Address Admin state Line state Rt instance
这是我的代码:
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=HOST,port=22,username=USER,password=PASSWORD)
channel = client.invoke_shell()
channel.settimeout(20)
channel.send(cmds)
time.sleep(5)
while channel.recv_ready():
print(channel.recv(99999).decode("utf_8"))
client.connect(hostname=HOST,password=PASSWORD)
channel = client.get_transport().open_session()
channel.invoke_shell()
channel.send(cmds)```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)