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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -