Although password lists like 'rockyou.txt' can provided decent results when bruteforcing passwords from unknown targets, in most real world situations there is likely
you do know information about the target. And because many people (previously myself included) use passwords that are partially or entirely made out of publicly available information, I decided to create a simple tool in Python that can be used to generate password lists with information about a target.
If you have any suggestions on how to improve the code or want to share any of the scripts that you've come up with, please do contact me.
Followed underneath are the instructions for using the SmartBrute tool. If you have any problems feel free to ask for under the issues tab or on Twitter. The code used for these instructions can also be found in the 'example01.py' file in the repository.
To start you will need to download the smartbrute.py file and include it in the same directory as the script you want to use it in. You can then import the needed code by putting from smartbrute import *
at the top of your script.
from smartbrute import *
You can then make a SmartList object, which I will call SB
. The 'example01.txt'
string is the name of the file you want to put the generated password list into and giving the name of a file that already exists will overwrite that file.
SB = SmartList('example01.txt')
If you want to filter the generated passwords to, for example, not include any passwords longer then 63 characters (the maximum length of WPA2-PSK passwords), you can filter the generated passwords by calling the setFilter
function with a dictonary. If you do not wish to filter the generated passwords in any way, you can skip this step.
SB.setFilter({
"max-length": 63,
"min-length": 8
})
The whole point of SmartBrute is to generate password lists using information about the target, in this step we'll declare some variables to hold that information. Depending on what passwords you want to generate and what information you have you will have to decide what variables to create. For this example we will be trying to crack the wifi password of an imaginary family.
NAMES = ['homer', 'marge', 'bart', 'lisa', 'maggie']
SURNAME = 'Simpson'
Now that SmartBrute is properly set up it is time to generate passwords and add them to the outputfile. The basis for this is the add()
method, which takes in an array/list of passwords and adds them to the output file.
For the first example I will use the GetAllTrueComb()
function to generate all possible combinations that can be made with the names.
For the second example I will do the same thing as in the first example but this time I will nest the CapFirstChar()
function inside the GetAllTrueComb()
function to capitalize the first character of every name.
For the third exmaple I will simply Combine the surname with the string 'Guest', keep in mind that the add()
method takes a array/list of strings so when you want to add only one string you should encase it with brackes ([]
) to make it an array/list.
Of course these are just a few examples and SmartBrute actually contains many more functions that can be used to generate all sorts of passwords (see chapter 2 below). If you don't want to come up with password generation scripts yourself, you should check out the example02.py
file, which generates a whole bunch of passwords based on research and stastics that's been done into common patterns people use for passwords.
SB.add(GetAllTrueComb(NAMES))
SB.add(GetAllTrueComb(CapFirstChar(NAMES)))
SB.add([SURNAME+'Guest'])
To tell the SmartBrute object that we are done generating passwords we need to call the stop()
method. This will also tell python to exit so no more code will be executed after this.
SB.stop()
Assuming all went well, our example script should produce the output displayed below. If you experience any errors please ensure that the smartbrute.py file is located in the same directory as the script, and that you are using Python 3.
homermarge
homermargebart
homermargebartlisa
homermargebartlisamaggie
homermargebartmaggie
homermargebartmaggielisa
...
MaggieLisaBartHomer
MaggieLisaBartHomerMarge
MaggieLisaBartMarge
MaggieLisaBartMargeHomer
SimpsonGuest
SmartBrute includes a bunch of different functions to manipulate and generate arrays/lists of strings. All of them are listed below along with some explanation and usages examples. Please keep in mind that most of these functions can be nested/combined to generate some pretty complex passwords.
If you don't feel like making your own generation script or need some insperation, check out the example02.py
file, which generates a whole bunch of passwords based on research and stastics into common passwords patterns.
This description is now outdated. please write a new one.
Example | Output |
---|---|
ALFB = ['A','B','C'] GetAllComb(ALFB) |
['A', 'AB', 'ABC', 'AC', 'ACB', 'B', 'BA', 'BAC', 'BC', 'BCA', 'C', 'CA', 'CAB', 'CB', 'CBA'] |
The GetAllComb function returns all possible ways in which the given keys/strings can be combined, while always using every given key, and never using a key twice. PLEASE NOTE: For performance reasons I do not recommned using this function on extremely large arrays, or to nesting this function multiple times. As your computer may run out of RAM.
Example | Output |
---|---|
ALFB = ['A','B','C','D'] GetAllCombNoDoubles(ALFB) |
['ABCD', 'ABDC', 'ACBD', 'ACDB', 'ADBC', 'ADCB', 'BACD', 'BADC', 'BCAD', 'BCDA', 'BDAC', 'BDCA', 'CABD', 'CADB', 'CBAD', 'CBDA', 'CDAB', 'CDBA', 'DABC', 'DACB', 'DBAC', 'DBCA', 'DCAB', 'DCBA'] |
The GetFirstN function returns the first N characters of the given keys/strings. PLEASE NOTE: the GetFirstN function does not filter its output for doubles, it is therefore recommended to pass the output of this function through the RemoveDoubles function to avoid duplicates.
Example | Output |
---|---|
NAMES = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] GetFirst(NAMES, 2) |
['Ho', 'Ma', 'Ba', 'Li', 'Ma'] |
The RepeatN function repeats the given keys N times.
Example | Output |
---|---|
NAMES = ['Homer', 'Marge', 'Bart'] RepeatN(NAMES, 3) |
['homerhomerhomer', 'margemargemarge', 'bartbartbart'] |
The RepeatN function repeats the given keys N times till.
Example | Output |
---|---|
NAMES = ['Homer', 'Marge', 'Bart'] RepeatTillN(NAMES, 3) |
['homer', 'homerhomer', 'homerhomerhomer', 'marge', 'margemarge', 'margemargemarge', 'bart', 'bartbart', 'bartbartbart'] |
The GenYears function returns all the years between the start and the stop year.
Example | Output |
---|---|
GenYears(1995,2008) |
['1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008'] |
The AddString function will add a given string to the end of every given key.
Example | Output |
---|---|
NAMES = ['Homer', 'Marge', 'Bart'] AddString(NAMES, 'Simpson') |
['HomerSimpson', 'MargeSimpson', 'BartSimpson'] |
Bro you need to add text here
Example | Output |
---|---|
NAMES = ['bart', 'lisa', 'maggie'] YEARS = ['2000', '2001', '2002'] AddForEach(NAMES,YEARS) |
['bart2000', 'bart2001', 'bart2002', 'lisa2000', 'lisa2001', 'lisa2002', 'maggie2000', 'maggie2001', 'maggie2002'] |
The ReplaceString function will replace parts of the given keys with a new string.
Example | Output |
---|---|
NAMES = ['Homer', 'Marge', 'Bart'] ReplaceString(NAMES, 'e', '3') |
['Hom3r', 'Marg3', 'Bart'] |
The RemoveDoubles function will filter the given keys for duplicate keys.
Example | Output |
---|---|
CHARS = ['a','a','b','b','b','c',] RemoveDoubles(CHARS) |
['a', 'b', 'c'] |