亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問板塊 發(fā)新帖
查看: 1792 | 回復(fù): 3
打印 上一主題 下一主題

[網(wǎng)絡(luò)相關(guān)] 請(qǐng)教一個(gè)關(guān)于路由器多命令執(zhí)行(5000條左右)程序 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2015-11-04 14:45 |只看該作者 |倒序?yàn)g覽
由于應(yīng)用需要和設(shè)備自身限制的原因,需要telnet登錄設(shè)備后,逐條命令在路由器上執(zhí)行,并記錄結(jié)果.
大部分結(jié)果應(yīng)該是為空白的.用python或者expect都行.
之前參考過(guò)http://72891.cn/thread-4177907-1-1.html這個(gè)帖子的程序,但是這個(gè)是采用了多進(jìn)程登陸多臺(tái)設(shè)備,和我這個(gè)情況不同.我只是需要登陸一臺(tái)設(shè)備,并執(zhí)行多條命令.
先謝謝了!

論壇徽章:
41
操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-08-21 06:20:00每日論壇發(fā)貼之星
日期:2016-05-05 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-05 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-05-05 06:20:0015-16賽季CBA聯(lián)賽之山西
日期:2016-04-27 08:49:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-25 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-17 06:23:2815-16賽季CBA聯(lián)賽之吉林
日期:2016-03-25 15:46:3415-16賽季CBA聯(lián)賽之四川
日期:2016-03-25 14:26:19操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-27 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-28 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-08-18 06:20:00
2 [報(bào)告]
發(fā)表于 2015-11-04 16:18 |只看該作者
可以的,問題是你不好判斷設(shè)備輸出的結(jié)果時(shí)間,,結(jié)果直接在log中查看即可,中間的那些sleep都是在等待設(shè)備輸出

執(zhí)行的時(shí)候執(zhí)行bash xx.py >> log.log
  1. #!/usr/bin/python
  2. import telnetlib
  3. import time
  4. host='10.10.10.10'
  5. username='admin'
  6. password='huawei123'
  7. finish='(config)]#'
  8. tn=telnetlib.Telnet(host)
  9. tn.set_debuglevel(7)
  10. tn.read_until('[.login    .] Login:>')
  11. tn.write(username+'\n')
  12. tn.read_until('[.password .] Password:>')
  13. tn.write(password+'\r\n')
  14. tn.read_until('[%eSpace U1960]>')
  15. tn.write('en\r\n')
  16. tn.read_until('[.password .] Password:>')
  17. tn.write(password+'\r\n')
  18. tn.read_until('[%eSpace U1960(config)]#')
  19. tn.write('config conference cancel confid 7\n')
  20. time.sleep(5)
  21. tn.write('config conference cancel confid 6\n')
  22. time.sleep(5)
  23. tn.write('config conference cancel confid 5\n')
  24. time.sleep(5)
  25. tn.write('config conference cancel confid 4\n')
  26. time.sleep(5)
  27. tn.write('config conference cancel confid 3\n')
  28. time.sleep(5)
  29. tn.write('config conference cancel confid 2\n')
  30. time.sleep(5)
  31. tn.write('config conference cancel confid 1\n')
  32. time.sleep(5)
  33. tn.write('config conference cancel confid 0\n')
  34. time.sleep(5)
  35. tn.write('\n')
  36. tn.read_until('[%eSpace U1960(config)]#')
  37. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  38. time.sleep(5)
  39. tn.write('\n')
  40. tn.write('config conference addattendee confid 0 attendeedn 690\n')
  41. time.sleep(5)   
  42. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  43. time.sleep(5)
  44. tn.write('\n')
  45. tn.write('config conference addattendee confid 1 attendeedn 691\n')  
  46. time.sleep(5)
  47. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  48. tn.write('\n')
  49. time.sleep(5)
  50. tn.write('config conference addattendee confid 2 attendeedn 692\n')  
  51. time.sleep(5)
  52. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  53. time.sleep(5)
  54. tn.write('\n')
  55. tn.write('config conference addattendee confid 3 attendeedn 693\n')
  56. time.sleep(5)
  57. tn.write('config conference register regnum 3 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  58. time.sleep(5)
  59. tn.write('\n')
  60. tn.write('config conference register regnum 3 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  61. time.sleep(5)
  62. tn.write('\n')
  63. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  64. time.sleep(5)
  65. tn.write('\n')
  66. tn.write('config conference addattendee confid 6 attendeedn 694\n')
  67. time.sleep(5)
  68. tn.write('\n')
  69. tn.write('config conference register regnum 9 attendeepwd 111111 chairmanpwd 111111  starttime 00:05:01 endtime 23:59:59\n')
  70. time.sleep(5)
  71. tn.write('\n')
  72. tn.write('config conference addattendee confid 7 attendeedn 695\n')
  73. time.sleep(5)
  74. tn.write('\n')
  75. tn.write('\n')
  76. tn.write('\n')
  77. tn.write('\n')
  78. tn.write('\n')
  79. tn.write('\n')
  80. tn.write('\n')
  81. tn.write('\n')
  82. tn.write('\n')
  83. tn.write('\n')
  84. tn.write('\n')
  85. tn.write('\n')
  86. tn.write('\n')
  87. tn.read_until('[%eSpace U1960(config)]#')

  88. tn.close()
復(fù)制代碼

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2015-11-04 16:28 |只看該作者
感謝! 不過(guò)有幾個(gè)問題,log時(shí)間我是不需要的,有輸出就行.由于命令本身已經(jīng)已經(jīng)根據(jù)正則表達(dá)式過(guò)濾,只要有輸出就可以.命令基本就是 "show route xx.xx.xx.xx/xx" 這種的,但是只能一次寫入一條.現(xiàn)在把所有命令編輯到一個(gè)文本中,如何才能逐條執(zhí)行,并合并返回結(jié)果呢? 像之前說(shuō)的基本大部分返回結(jié)果應(yīng)該都是空白回復(fù) 2# jixuuse


   

論壇徽章:
41
操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-08-21 06:20:00每日論壇發(fā)貼之星
日期:2016-05-05 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-05 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-05-05 06:20:0015-16賽季CBA聯(lián)賽之山西
日期:2016-04-27 08:49:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-25 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-04-17 06:23:2815-16賽季CBA聯(lián)賽之吉林
日期:2016-03-25 15:46:3415-16賽季CBA聯(lián)賽之四川
日期:2016-03-25 14:26:19操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-27 06:20:00操作系統(tǒng)版塊每日發(fā)帖之星
日期:2016-05-28 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-08-18 06:20:00
4 [報(bào)告]
發(fā)表于 2015-11-04 16:37 |只看該作者
你可以把命令做個(gè)成文本,然后for循環(huán)讀取執(zhí)行,循環(huán)完了就執(zhí)行完了唄
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP