(You can extend that to include uppercase, digits 0-9 with rot5 y/0-9/5-90-4/, and other characters similarly y/!@#$%^&*(){}[];:<>,./{}[];:<>,.!@#$%^&*()/)$ perl -lwe ' use strict; my $password = "abcdefg"; $password =~ y/a-z/n-za-n/; print $password; ' nopqrst
Other possibilities include using pack/unpack, Data::Serializer, etc. You can store the obscured data in a separate file and read it in before de-obscuring it.
To keep the password off the command-line and thus out of ps -ef and equivalents, many commands have an option to prompt for the password. For those, something like echo $password | command -p may work. Other commands - mysql is one - will not accept the password that way. For some of those, Expect can be used.
None of these will keep a determined person from getting the information; they merely make him work a little bit more. They are, however, slightly better than plaintext passwords in the code.
In reply to Re: Hiding/masking your username or password
by keszler
in thread Hiding/masking your username or password
by newbie01.perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |