I've been reading a article about the Python Subprocess Module, specifically about subprocess.Popen
, which explains how the Python allows you to communicate with the executed process.
I made a small example for Windows (sorry, I do not have a Linux to test this now) that changes the system date:
import subprocess
processo = subprocess.Popen(args = ['date'],
stdin = subprocess.PIPE,
stderr = subprocess.PIPE,
shell = True)
processo.communicate(b'01-01-01')
The code above was tested in the default implementation of Python (CPython) version 3.3. Note that the processo.communicate(b'01-01-01')
line sends the 01-01-01
value to the date
command.
The console output is:
The current date is: Tue 01/28/2014
Enter the new date: (mm-dd-yy) 01-01-01
I believe you can adapt the Popen
command to run dump and then send the password using the communicate
method.