Home > computers > linux > bash > bashsalt | About

Some rudimentary examples on the command line

ychaouche@ychaouche-PC ~ $ echo $(head -5 /dev/urandom | strings | base64 | tr -d "='\n'\+")
S1N6Q1p2cQpuME42dAosNS0/b2oKVC5aLgopMjQ3CmBOd1FSUgp8eDQhCm8XGkKZmJySwpkUShMaQp7c2ZHCjJ5enEKREZ8SAordiplWwouNGojOApJPDNQLFZ4CkQtbHwqcApvJVFxXwo6PnF8LgoyKTBjCkUpPGR5Cj88W1hpCjh5Ii0KfUc4OgopUSBTCi1CXCVKewo
ychaouche@ychaouche-PC ~ $ echo $(head -5 /dev/urandom | strings | base64 | tr -d "='\n'\+")
XXFoPSIKRl4/CQoiSi8rYQo9Pyw8KXkKTzNkUwpNUGxFCiNyRiYqClNxMihBCk85fXcKKnoqJFsKRSJeMwpve1RTCm5hWCAmewosPT1KCkFZa1kKUgldNgpAelhGYwpndTxjcz0oCmZiIT4lKwpxLCtoXwogSmw9IAo1YTAPwpMVz8nXXoKQjQJJ0cKZDx9VQp7UklWClNkUFMKJ01vegpmLnImUQpWYTVyCllxZXUK
ychaouche@ychaouche-PC ~ $ echo $(head -5 /dev/urandom | strings | base64 | tr -d "='\n'\+")
VUJTMHsKL29rIwpgVV9ge3oKQFk9bAp7VTFSCm9FOGIKSiswakgKT2JKQwo6M3A8dApibQlbClZOSAKKjxNLGkKN0p4NQpaamBTCmY/WH50ZTpJCi9cRDEK
ychaouche@ychaouche-PC ~ $ 

Transformed into a bash function

function generate_random_salt {
    randomstring="$(head -5 /dev/urandom | strings | base64 | tr -d '\n\-\+')"
    echo ${randomstring::2}                                                     
}  

That I can now use in my bash scripts that generate sql queries

root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','PF'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','VU'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx                                                          
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','fC'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','Qn'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','TV'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','CV'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','ZF'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','LH'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','YG'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','In'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','by'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','WE'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','NU'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','JU'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','an'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','cy'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','Sk'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # ./createmailbox.single.sql ali.mellah@algerian-radio.dz "ALI MELLAH" "xxx"
password was xxx
mysql -uuser -ppass mail -e INSERT INTO users (email,name,password,maildir,quota) value ('ali.mellah@algerian-radio.dz','ALI MELLAH',encrypt('xxx','el'),'/var/vmail/algerian-radio.dz/ali.mellah',1073741824);
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # 

contact : @ychaouche yacinechaouche at yahoocom


QR Code
QR Code bashsalt (generated for current page)