我尝试使用ssh连接到路由器,以便自动从中提取一些日志。
我在下面开发了此代码:
#!/usr/bin/expect -f
spawn ssh root@192.168.1.1
expect "Are you sure you want to"
send -- "yes\r"
expect "password"
send -- "root\r"
expect "\#"
send -- "ls\r"
expect "\#"
问题是我希望在输出日志中出现提示之前出现垃圾。
spawn ssh root@192.168.1.1
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is SHA256:6aeE74qXMeQzg0SGJBZMIa0HFQ5HJrNqE5f3XZ6Irds.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/amin/.ssh/known_hosts).
root@192.168.1.1's password:
BusyBox v1.30.1 () built-in shell (ash)
OpenWrt Version: ALPHA
OpenWrt base: 19.07
------------------------------------
]0;root@openwrt: ~root@openwrt:~# ls
[0;0mnetwork[m
]0;root@openwrt: ~root@openwrt:~#
此问题的主要原因是什么?我该如何解决?