2012-09-30 56 views
0

所以我終於得到exscript正常工作(我認爲)。我想測試它,所以我設置一個簡單的Python腳本,我相信應該工作:Exscript TimeoutException

from Exscript.util.interact import read_login 
from Exscript.protocols import SSH2 

account = read_login() 
conn = SSH2() 
conn.connect('router.domain.com') 
conn.login(account) 

conn.execute('terminal length 0') 

conn.execute('show version') 
print conn.response 

conn.send('exit\r') 
conn.close() 

我運行該腳本,我看到下面的:

[email protected] scripts$ python test1.py 
Please enter your user name [kidd]: 
Please enter your password: 

它坐在那裏約20秒,然後我得到這個:

Traceback (most recent call last): 
    File "test1.py", line 7, in <module> 
    conn.login(account) 
    File "/usr/lib/python2.7/site-packages/Exscript/protocols/Protocol.py", line 597, in login 
    self.auto_app_authorize(app_account, flush = flush) 
    File "/usr/lib/python2.7/site-packages/Exscript/protocols/Protocol.py", line 846, in auto_app_authorize 
    self.get_driver().auto_authorize(self, account, flush, bailout) 
    File "/usr/lib/python2.7/site-packages/Exscript/protocols/drivers/one_os.py", line 43, in auto_authorize 
    conn.app_authorize(account, flush, bailout) 
    File "/usr/lib/python2.7/site-packages/Exscript/protocols/Protocol.py", line 820, in app_authorize 
    self._app_authenticate(account, password, flush, bailout) 
    File "/usr/lib/python2.7/site-packages/Exscript/protocols/Protocol.py", line 690, in _app_authenticate 
    raise TimeoutException(msg) 
Exscript.protocols.Exception.TimeoutException: Buffer: '\rThis is a private system \r\n \r\nrouter>' 

我是否缺少一些簡單的東西?試圖登錄路由器(作爲普通用戶,非特權模式),運行一個演示版本,然後註銷。任何幫助,將不勝感激。謝謝。

回答

2

它看起來像您配置的橫幅正在與Exscript期待從設備回來的提示混淆。我建議在Exscript中調整協議驅動程序以更好地處理提示,或者確保您的橫幅設置正確(或一起移除它)

相關問題