Gila River
Gila River

Reputation: 11

How to write a Python script that will generate a word list with all possible iterations of STATE+YEAR?

I want to write a Python script that generates a word list with all possible iterations of STATEYEAR. STATE is an array of states the target has lived in, let's say

['Alaska', 'Hawaii', 'Texas', 'California', 'Oregon', 'NewMexico', 'Colorado']

and YEAR is an array of years from 1990-2000.

Basically, I am creating a wordlist for password cracking and I'm assuming the target's password is a combination of the above states and years.

Upvotes: 1

Views: 923

Answers (1)

lmiguelvargasf
lmiguelvargasf

Reputation: 69675

Assuming you are using Python 3.6+. You can use the following code to generate a list containing all possible combinations of 'stateyear'.

STATES = ['Alaska', 'Hawaii', 'Texas', 'California', 'Oregon', 'NewMexico', 'Colorado']
YEARS = range(1990, 2000 + 1)

output = [f'{state}{year}' for state in STATES for year in YEARS]

If your version of Python is lower than Python 3.6:

output = ['{}{}'.format(state, year) for state in STATES for year in YEARS]

Upvotes: 2

Related Questions