So a while back, I figured out that a lot of retail stores use their business phone numbers for their WIFI passwords.
I then thought, (for educational purposes only) what would it take to capture some of their wifi and brute force with known password list that is phone numbers in the area....
At the time I wrote a lenghty script to generate a file that had all 10000 (or at least 9998) numbers in it. Now to be clear, I have never actually used this for any malicious purposes, and I have never in fact even used it for the intended purpose. But I did create scripts to generate a wordlist filled with phone numbers, and that was kinda fun.
Now enter my newfound tips of a for loop generator that I used in one of my previous articles to generate sequential IP addresses... and I think I figured out a way to make a python list with all phone numbers in a pre-fix with one line of code.....COOL.
phoneNums = ["408604{}".format(str(i).zfill(4)) for i in range(1, 9999)]
len(phoneNums)
9998
And just to be sure that the list is what I am looking for:
phoneNums[10]
'4086040011'
So, to explain a little, the start is a '[' to encapsulate a list, then a string "408604" with a variable holder '{}' followed by '.format(' Then I get the real magic. See you have to have leading zeros in phone numbers to make them valid. If I just used the 'range(1, 999)' by itself, it would have bogus numbers for the first 1000. But in using 'str(i).zfill(4))' it buffers all of the incremented numbers with leading zeros until it makes 4 digits long.
Now please feel free to use this tip for other incremental lists to be made, or even making a phonenumber wordlist to guess passwords...but remember, DO NOT DO ANYTHING ILLEGAL!!.