PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Using Bash To generate keys in a specific format

Go down

Using Bash To generate keys in a specific format Empty Using Bash To generate keys in a specific format

Post by jamied_uk 13th October 2022, 13:49

Generate keys

prepare the format then run keys.sh to create a key list for pen testing!

Instead of trying to generate 12 digit wifi keys in 1 go (would be way too long and inective for example it would have AAA type output)!

We going to break the wifi key into 4 parts of 3 chars each recognising the wifi format of the code!

Create a folder

Code:
mkdir wordlists


gen1.sh (example)
Code:
crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t @@% | perl -ne 'print unless /([A-Z]).*\1/' > wordlists/1.txt

gen2.sh (example)

Code:
crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t ,@@ | perl -ne 'print unless /([A-Z]).*\1/' > wordlists/2.txt

gen3.sh (example)

Code:
crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t @@@ | perl -ne 'print unless /([A-Z]).*\1/' > wordlists/3.txt

gen4.sh (example)

Code:
crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t %@@ | perl -ne 'print unless /([A-Z]).*\1/' > wordlists/4.txt




Now putting it to gether to make a valid 12 digit vm wifi key!


Code:
#!/bin/bash
# (c)J~Net 2022
# jnet.club
# https://jnet.forumotion.com/t1887-using-bash-to-generate-keys-in-a-specific-format#2932
#
#
# ./key.sh 1000
#
#
echo "Hi $USER, Welcome To Key Gen V5 By J~Net 2022"
echo "Setting Up Pre Reqs!"
# Lets check if you have required apps installed to do this job...
input=`which perl`
if [ $input = "/usr/bin/perl" ]
then
    echo "You Have Perl Installed Already"
else
    echo "Installing Perl"
    sudo apt install -y perl
fi
#
input=`which crunch`
if [ $input = "/usr/bin/crunch" ]
then
    echo "You Have Crunch Installed Already"
else
    echo "Installing Crunch"
    sudo apt install -y crunch
fi
#
if [ -z "$1" ]
then
   echo "How Many keys You Want?"
   read num

else
        num=$1

fi
#
file="wordlists/1.txt"
if [[ -f $file ]]
then
    echo ""
else
    sudo mkdir wordlists
    touch $file
    crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t @@% | perl -ne 'print unless /([A-Z]).*\1/' > $file
fi
#
file="wordlists/2.txt"
if [[ -f $file ]]
then
    echo ""
else
    sudo mkdir wordlists
    touch $file
    crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t ,@@ | perl -ne 'print unless /([A-Z]).*\1/' > $file
fi
#
#
file="wordlists/3.txt"
if [[ -f $file ]]
then
    echo ""
else
    sudo mkdir wordlists
    touch $file
    crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t @@@ | perl -ne 'print unless /([A-Z]).*\1/' > $file
fi
#
file="wordlists/4.txt"
if [[ -f $file ]]
then
    echo ""
else
    sudo mkdir wordlists
    touch $file
    crunch 3 3 abcdefghijklmnopqrstuvwxyz -d 1 -t %@@ | perl -ne 'print unless /([A-Z]).*\1/' > $file
fi
#
i=0
echo "Getting $num Random Wifi keys"
      
while [ $i -lt $num ]
do
      echo ""
   i1=`shuf -n 1 wordlists/1.txt`
   i2=`shuf -n 1 wordlists/2.txt`
   i3=`shuf -n 1 wordlists/3.txt`
   i4=`shuf -n 1 wordlists/4.txt`

   echo "$i1$i2$i3$i4" >> keys.txt
   echo "Generating New Wifi Key $i of $num Is: $i1$i2$i3$i4"
   
   ((i++))

done
Code:
sudo chmod +x *.sh


Code:
./keys.sh
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Using Bash To generate keys in a specific format Empty Re: Using Bash To generate keys in a specific format

Post by jamied_uk 14th October 2022, 17:40

Generate Online Example

jnet.sytes.net/apps/Crypto/Wifi-Keys/VM
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum