Skip to content

Instantly share code, notes, and snippets.

@av1d
Created August 15, 2021 17:55
Show Gist options
  • Save av1d/e930df3a1509f04d629988c74fd57a6f to your computer and use it in GitHub Desktop.
Save av1d/e930df3a1509f04d629988c74fd57a6f to your computer and use it in GitHub Desktop.
Generate voicemail PINs
#!/bin/bash
read -p " Starting number? " startnum_int
read -p " Ending number? " endnum_int
read -p " Randomize (y/n)? " randomize_bool
read -p " Pad digits (y/n)? " paddigits_bool
if [[ "$paddigits_bool" == "y" ]]
then
read -p "PIN length for padding? " pinlength_int
else
pinlength_int=0
fi
pinlength="0${pinlength_int}g"
echo "Generating:"
echo "----------"
echo " Start: $startnum_int "
echo " End: $endnum_int "
echo "Random: $randomize_bool"
echo " Pad: $paddigits_bool"
echo "Length: $pinlength_int "
echo "----------"
the_date=$(date +"%m-%d-%Y_-_%H-%M-%S-%p")
output_file="password_list_-_${the_date}.txt"
if [[ "$paddigits_bool" == "y" ]]
then
for i in $(seq -f "%${pinlength}" $startnum_int $endnum_int)
do
echo $i >> $output_file
echo $i
done
if [[ "$randomize_bool" == "y" ]]
then
cat $output_file | shuf > password.temp && mv password.temp $output_file
fi
else
for i in $(seq $startnum_int $endnum_int)
do
echo $i >> $output_file
echo $i
done
if [[ "$randomize_bool" == "y" ]]
then
cat $output_file | shuf > password.temp && mv password.temp $output_file
fi
fi
echo "Done. file saved to: "$output_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment