我有以下代码可以很好地连接到我的路由器。问题是一旦连接,我尝试传递永远不会传递给路由器的“sh ver”命令。谢谢你的帮助!
需要“网络/远程登录”
cisco = '1.1.1.1' #Enter the IP address here
user = 'admin' #Enter username here
pass = 'mypass' #Enter password here
tn = Net::Telnet::new('Host' => cisco, 'prompt' => /^\Username:/ )
tn.cmd('String'=>'admin', 'Match'=>/Password:/) { |c| puts c }
tn.cmd(pass) { |c| puts c }
------------------Does not work below this line---------------------
tn.cmd('String'=>'sh ver')