windows - Run program from command line what prompts password and automatically provide password for it (cmd.exe, python) -


i have command line program prompts password:

> cwrsync root@nn.nn.nn.nn:/src /cygdrive/c/dst 

output (when run cmd.exe command line):

root@nn.nn.nn.nn's password: 

when input password manually, ok. output:

skipping directory src 

i want provide password command line or python script automatically.

i tried:

one. command line:

> echo pass|cwrsync -r root@nn.nn.nn.nn:/src /cygdrive/c/dst 

not working. output:

root@nn.nn.nn.nn's password: 

two. python script. test.py:

import subprocess cmd = "cwrsync -r root@nn.nn.nn.nn:/src /cygdrive/c/dst" proc = subprocess.popen(cmd1, stdout=subprocess.pipe, stderr=subprocess.pipe, stdin=subprocess.pipe, shell=true) std1, std2 = proc.communicate("pass") print std1print std2 

not workin. output:

permission denied, please try again. permission denied, please try again. permission denied (publickey,password). rsync: connection unexpectedly closed (0 bytes received far) [receiver] rsync error: unexplained error (code 255) @ io.c(235) [receiver=3.1.1] 

it common security oriented programs ask password on direct io instead of reading stdin. , :

echo pass|cwrsync -r root@nn.nn.nn.nn:/src /cygdrive/c/dst 

did ask password, presume csrsync directly reads console.

in case cannot automate without work , low level programming, because have simulate keyboard actions. should instead search documentations, because looks uses underlying ssh, accept public key pair. if accept 1 without passphrase, should able automate it.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -