Hi all.
This is my first post and i am bit new to python. Pls dont mind if my question is dumb, kindly guide me
I am writing a pexpect script (i am using linux Centos 5.5) to access my cisco router and want to record the output of "show version" command
This is my script
import pexpect
import sys
child = pexpect.spawn("ssh homeuser@192.168.15.5")
child.expect("Password:")
child.sendline("abc123")
child.expect("HomeR1>")
child.sendline("show version")
Now i can see on my router that i have successfully logged in. But i dont know how to catch the output and save it to a file. I saw several examples like child.logfile = sys.stdout etc but i really dont know how to get it working.
Pls if someone has experience with pexpect, kindly help me out.
Note: I have already cached the ssh keys, so to avoid complexity.
Thanks in advance