Python中文
首页
教程
问答
标签
搜索
登录
注册
使用python scrip与路由器的ssh连接
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我想知道是否有可能使用python脚本来连接到路由器并通过ssh连接控制接口(关闭、重新启动无线网络等等)。</p> <p>到目前为止,我写了这些台词,但仍然不起作用。当我看着终端时,我看到所有的东西都被阻塞了,这时我的脚本应该会回显路由器的密码以完成连接。我怎样才能纠正这个问题?</p> <p>下面是台词:</p> <pre><code>import os, urllib, urllib2, re def InterfaceControl(): #os.system("echo training") os.system("ssh -l root 192.168.2.1") os.system("echo yes") os.system("echo My_ROUTER_PASSWORD") os.system("shutdown -r") def main(): InterfaceControl() if __name__=="__main__": main() </code></pre> <p>提前谢谢你</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>你要找的是<a href="http://plumbum.readthedocs.org" rel="nofollow">plumbum</a>。(<a href="http://plumbum.readthedocs.org/en/latest/remote.html#guide-remote-commands" rel="nofollow">remote commands</a>)</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
区分轴上的像素大小
1 回答
区分过度拟合与良好预测
10 回答
区分通过POST接收的数据并在Cherrypy中获取
2 回答
区分重写和重载
4 回答
区分金贾二号的类型
3 回答
区别:IF IN和IF==python
2 回答
区别:list.append()与incrementequal?
9 回答
区别:创建在启动wx应用程序时不“阻止”控制台的脚本
7 回答
区别于python中的命令行和CGI
3 回答
区别关系
6 回答
区别是什么APIClient.enforce\ csrf\检查以及APIClient.handler.enforce\ csrf\ u检查
5 回答
区块.draw()未在python空闲模式下工作
6 回答
区块链API调用输出对象名称而不是内容
5 回答
区块链nonce值随负载变化
1 回答
区块链Python语法错误(Snakecoin)
3 回答
区块链不连接到服务器和矿工
7 回答
区块链信息钱包支票支付员
3 回答
区块链和区块链密码错误
1 回答
区块链尝试向Transaction字典添加键/值以创建区块链
4 回答
区域:IOError:[Errno 22]无效模式('w')或filenam
10 回答