python - pexpect trying to print the contents of a remote file -
i'm learning pexpect , trying automate listing of log file on remote servers, far can printout if add child.interact() @ end.
what i'd ssh server, cat log file , print output screen can log on local server.
import pexpect child = pexpect.spawn('ssh admin@172.16.200.51') child.expect('password:') child.sendline('some pass') child.expect('>') child.sendline('enable') child.expect('#') child.sendline('su') child.expect('password:') child.sendline('somepass') child.expect('$') child.sendline('cat /var/log/vent2.log') child.expect(''$') print(child.before)
im not sure why not printing out.
Comments
Post a Comment