Wednesday, January 25, 2012

python winpdb automation

I wasted some time trying to automate the launching of winpdb without asking the user for the password; hoping that what I found out will help somebody:

Passing the password to winpdb with -p is unsupported on unix, because of security issues (the command line parameters can be seen by anyone). However there is an undocumented --rid parameter which takes an integer which is used to construct a file name which will contain the password (beware: no newline after the password). winpdb will delete this password file after reading it. You should create this file it with appropriate permissions.

Here's a bash haiku to show what I mean:

 RID=$RANDOM; echo -n 'test' >/home/marko/.rpdb2_settings/passwords/$RID; winpdb --rid $RID --attach yourscript.py