Wordlist Generator in Bash

1.8k views Asked by At

I am trying to create a wordlist consisting of the same password followed by a 4-digit numeric pin. The pin goes through every possible combination of 10,000 variations. The desired output should be like this:

 UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ 1111
 UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ 1112
 UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ 1113

and so on.

I created a shell script that almost get this, but awk doesn't seem to like having a variable passed through it, and seems to just print out every combination when called. This is the shell script:

#!/bin/bash
# Creates 10,000 lines of the bandit24pass and every possible combination
# Of 4 digits pin

USER="UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ"

PASS=$( echo {1,2,3,4,5,6,7,8,9}{1,2,3,4,5,6,7,8,9}{1,2,3,4,5,6,7,8,9}{1,2,3,4,5,6,7,8,9} | awk '{print $I}' )

for I in {1..10000};
do
        echo "$USER $PASS"
done

I though $I would translate to $1 for the first run of the loop, and increment upwards through each iteration. Any help would be greatly appreciated.

2

There are 2 answers

2
oguz ismail On

I though $I would translate to $1 for the first run of the loop, and increment upwards through each iteration.

No, command substitutions are expanded once; like, when you do foo=$(echo), foo is an empty line, not a reference to echo.

This whole task could be achieved by a single call to printf btw.

printf 'UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ %s\n' {1111..9999}
1
Digvijay S On

Tyr this

$echo $user
UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ
$for i in {1000..9999}; do echo $user $i; done;