Hiding stuff like passwords in source?
nobody
root at [127.0.0.1]
Sat Dec 8 15:44:56 EST 2001
Keep your passwords in environment variables (if your OS doesn't support
them, or can't protect them from prying eyes, kill yourself immediately :).
Add to the top of your script:
USERNAME = 'guest'
PASSWORD = 'guest'
#any other variables that need to be easily seen by others
if os.getenv('somesite_username') != None:
USERNAME = os.getenv('somesite_username')
if os.getenv('somesite_password') != None:
PASSWORD = os.getenv('somesite_password')
Anyone you send the script to can see plain as day where they have to change
their username/password info, and if they're a little smarter they'll notice
they can also set their environment variables.
Additionally, this script will now function for all users on a multiuser
system (and can therefore be world readable/executable), all they have to do
is add their username/password to their profile and voila.
More information about the Python-list
mailing list