Last active
April 10, 2018 23:55
-
-
Save altmas5/9f3c7ed75abbb449c303d7993aa4d1e9 to your computer and use it in GitHub Desktop.
Generate the Asterisk passwdfile accepted by the Authenticate function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "Debe recibir el número de códigos a generar como parametro"; | |
exit; | |
fi | |
n=$1 | |
for i in $(seq 1 $n) | |
do | |
echo "Generando contrasena $i"; | |
random=`/usr/bin/shuf -i 1111-9999 -n 1`; | |
randomhashed=`echo -n $random | md5sum`; | |
echo -n "$random:$randomhashed"|rev|cut -c 4-|rev >> passwdfile.txt | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment