0

I have a simple script (below) which should return an output from a simple show command but instead I am getting the one line of the output or no output at all.

>>> from Exscript.protocols import *

>>> conn = SSH2()
>>> conn.connect("192.168.0.1")
>>> conn.login(Account("username", "password"))
>>> conn.send("\r")
>>> conn.response
u'--- JUNOS 13.2R7.5 built 2015-02-12 11:55:28 UTC'
>>> conn.execute("\r")
(0, <_sre.SRE_Match object at 0x7f6bd4707440>)
>>> conn.response
u''
>>> conn.execute("show version")
(0, <_sre.SRE_Match object at 0x7f6bd4707440>)
>>> conn.response
u'\r\n\r\n{master}\r\username@S1> '

Who knows how to fix this problem?

gh0st
  • 402
  • 5
  • 13
  • The first time you use `conn.send('\r')`, but the second time you use `conn.execute('\r')`. Is that intentional? – Zach Gates Aug 31 '17 at 02:35
  • Yes, I was looking for a solution to my problem. – gh0st Aug 31 '17 at 04:45
  • But Zach is right, you shouldn't use conn.send() in that case. The device will respond with an extra prompt, which confuses the later calls to execute() – knipknap Oct 23 '17 at 18:28

0 Answers0