1

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.

Ross Jacobs
  • 2,962
  • 1
  • 17
  • 27
Xenon
  • 171
  • 2
  • 9
  • What's wrong with `for i in {1000..11000}; do echo "$USER $i"; done`? If that's not a solution to your issue, than I think your description could use some clarification. – jordanm Mar 25 '20 at 05:05

2 Answers2

3

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}
oguz ismail
  • 1
  • 16
  • 47
  • 69
1

Tyr this

$echo $user
UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ
$for i in {1000..9999}; do echo $user $i; done;
Digvijay S
  • 2,665
  • 1
  • 9
  • 21