views:

42

answers:

0

Hi,

I'm using Pexpect to scp and get some files from a remote Linux machine. The script is run from a Linux machine and I'm unable to come to conclusion about the correct regex expression for the prompt which includes an IP.The SCP transfer works fine if IP is hardcoded. It generally looks like:

[email protected]'s password:

For this prompt, I'm just trying to match it with :

status=child.expect(["The authenticity of host",'mpxadmin\@\d\d\d.\d\d\d.\d\d\d.\d\d\d\'s password:',pexpect.EOF, pexpect.TIMEOUT])

There is also a prompt which asks if I would want to save the keys which looks like as follows:

The authenticity of host '10.10.10.19 (10.10.10.19)' can't be established.
key fingerprint is 0a:a6:a0:a7:a6:a7:a6:aa:aa:aa:aa:aa:aa:aa:aa:aa.
Are you sure you want to continue connecting (yes/no)?

Can you help me out with the regex for password prompt and for saving the keys.