【Gross】 A Password Manager You Can Make with Just .bashrc
Hello, I'm incompetent.
I'd like to introduce a gross password manager.
.bashrc
I have the following in my.bashrc.
By the way, since it's encoded withbase91, installingbase91is essential.
pp2091g() {
local dir="$HOME/.$FUNCNAME"
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $FUNCNAME <string> <filename>"
return 1
fi
if [[ ! -d $dir ]]; then
mkdir -p $dir
fi
if [[ -f $dir/$2 ]]; then
cat $dir/$2 | base91 | cut -c -20 | tr -d "\n" ; echo
return 0
fi
echo -n "$1" | sha384sum | awk '{print $1}' | xxd -r -p > $dir/$2
echo "Generated and saved to $dir/$2"
}
In other words, please refer to the following for the generation part.
I want a secure password with base91. - SOULMINIGRIG
It's a really simple password manager.
However, if you have manySSHdestinations, it's difficult to easily include special characters like this, so I've done it this way.
Have you ever found that you can remember short passwords for websites, but long ones are impossible?
So, by using this, you can generate relatively strong passwords with short strings, and since it encodes files that have been fully converted from hexadecimal to binary, the password itself is not stored in plain text.
This is what it looks like
It will look like this.
$ pp2091g string file
Generated and saved to /home/haturatu/.pp2091g/file
$ pp2091g string file
_+f2t2X9JyLf?S(GplK~
If special characters are not supported
If special characters are not supported bybase91encoding, use a long string encoded withbase64.
This is necessary because many Japanese sites do not support all special characters.
pp6464g() {
local dir="$HOME/.$FUNCNAME"
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $FUNCNAME <string> <filename>"
return 1
fi
if [[ ! -d $dir ]]; then
mkdir -p $dir
fi
if [[ -f $dir/$2 ]]; then
cat $dir/$2 | base64 | tr -d "\n" ; echo
return 0
fi
echo -n "$1" | sha384sum | awk '{print $1}' | xxd -r -p > $dir/$2
echo "Generated and saved to $dir/$2"
}
Drawbacks
Once saved, the file can be displayed by anystringscommand.
$ pp2091g string file
_+f2t2X9JyLf?S(GplK~
$ pp2091g stringa file
_+f2t2X9JyLf?S(GplK~
Because
if [[ -f $dir/$2 ]]; then
cat $dir/$2 | base64 | tr -d "\n" ; echo
return 0
fi
It's simply because itcats the binary here and encodes it as is.
Also, if thestringsare the same, the password will be the same.
Advantages
It's easy to manage. Since it's file-based, you can use it as is on another server if needed.
It's also easy to generate. Even if you lose the file, you can restore it as long as you remember the filename and thestrings.
The sole purpose of this password manager is the desire tobe as independent of external factors as possible, and to have a relatively secure password even if I can only remember short ones.
It might be strong against brute force, but it's vulnerable if the shell is compromised. However, if only the password is stolen without knowing the email address/phone number or where it's used, it doesn't really mean much.
Also, it's easy to customize since it's a simple shell script. You might usesha256suminstead ofsha384sum, and you can easily choose your preferred character encoding and string length.
That's all for now. Best regards.