Hiding stuff like passwords in source?

Michael Chermside mcherm at destiny.com
Fri Dec 7 17:33:43 EST 2001


Well, I'm going to come out with an argument "proving" why what you want 
to do can't be done. Then I'm going to sit back and wait for one of the 
brilliant minds here on c.l.p to send in a script proving me wrong.

You want your scripts to be able to enter passwords, but you DON'T want 
anyone to be able to get the passwords from the scripts. I could easily 
run your script in my environment where "/usr/bin/ssh" runs a program 
which captures passwords. So if your program EVER gives out a password, 
then it can't be secure.

There are, however, a few ways around this. If all you want to do is to 
protect against people casually reading the passwords in the sourcecode 
of your script then your own solution works excellently. To do somewhat 
better, you could somehow program the scripts to only give out the 
password (ie, only run) if it's YOU sitting there. Now unless you've got 
a fingerprint reader attached to your machine, the only likely way of 
proving that it's "you" is for you to supply a password.

Stupid though this sounds, it might actually solve your problem. You 
could write all the scripts so that they accept a 1st parameter of a 
"master_password". You'll have to type in this master_password every 
time you run every one of the scripts (yes, that's a pain!), but then 
you can code ftpid so that it accepts a master_password and only gives 
out the password if the master_password is given to IT by the script. 
Now you'd still have to type in ONE password every time you run 
anything, but at least it'd only be ONE password to remember.

If you DO try this though, please keep in mind that .pyc files can be 
reverse compiled fairly easily (or just inspected byte-by-byte for 
strings), so you probably want to rewrite ftpid so it contains only an 
encoded version of your real password and uses master_password to 
decrypt it.

Okay... how long before a c.l.p guru worms his/her way around my "proof"?

-- Michael Chermside


> Hello,
> 

  ...

> 
> What I'm wondering is if there's a way to encrypt,
> hide or otherwise modify the way I'm using my user
> info so that unless I am logged in at my machine, the
> user info is unusable and unreadable.
> 

  ...

> 
> I'd really like to preserve the ability to just click
> a script and have it run as "me", with my info and
> password.  I just don't want to let anyone else get at
> that information or be able to use it... but I *do*
> want to be able to easily give them the script so they
> can type in their own information and have it work for
> them on their server, etc.
> 
> Any ideas?
> 
> Thanks,
> 
> -dB
> 
> =====
> David Brady
> daves_spam_dodging_account at yahoo.com
> I'm feeling very surreal today... or *AM* I?
> 
> 






More information about the Python-list mailing list