java.lang.Object
me.gosimple.nbvcxz.resources.ConfigurationBuilder
public class ConfigurationBuilder
extends java.lang.Object
Builder class for creating
Configuration.- Author:
- Adam Brusselback.
-
Constructor Summary
Constructors Constructor Description ConfigurationBuilder() -
Method Summary
Modifier and Type Method Description ConfigurationcreateConfiguration()Creates theConfigurationobject using all values set in this builder, or default values if unset.static java.util.List<AdjacencyGraph>getDefaultAdjacencyGraphs()static longgetDefaultCombinationAlgorithmTimeout()static longgetDefaultCrackingHardwareCost()static java.util.List<Dictionary>getDefaultDictionaries()static java.lang.BooleangetDefaultDistanceCalc()static java.util.Map<java.lang.String,java.lang.Long>getDefaultGuessTypes()This list was compiled in August 2018 using a baseline of what could be bought for roughly $20k usd for the offline attack values.static java.util.Map<java.lang.String,java.lang.Long>getDefaultGuessTypes(java.lang.Long crackingHardwareCost)This list was compiled in August 2018 using a baseline of what could be bought for roughly $20k usd for the offline attack values.static java.util.Map<java.lang.Character,java.lang.Character[]>getDefaultLeetTable()static doublegetDefaultMinimumEntropy()static java.util.List<PasswordMatcher>getDefaultPasswordMatchers()static java.util.regex.PatterngetDefaultYearPattern()static java.math.BigDecimalgetMooresMultiplier()Returns the Moore's law multiplier we're using for getDefaultGuessTypes().ConfigurationBuildersetAdjacencyGraphs(java.util.List<AdjacencyGraph> adjacencyGraphs)AdjacencyGraphs are used to find spacial patterns within passwords (e.g.ConfigurationBuildersetCombinationAlgorithmTimeout(java.lang.Long combinationAlgorithmTimeout)Timeout for the findBestCombination algorithm.ConfigurationBuildersetCrackingHardwareCost(java.lang.Long crackingHardwareCost)Sets the cost of cracking hardware to scale the guesses / second for the default guess types.ConfigurationBuildersetDictionaries(java.util.List<Dictionary> dictionaries)Dictionaries are used by theDictionaryMatcherto find common words, names, and known passwords within the password.ConfigurationBuildersetDistanceCalc(java.lang.Boolean distanceCalc)Distance based dictionary calculations which provide support for misspelling detection, at the expense of performance.ConfigurationBuildersetGuessTypes(java.util.Map<java.lang.String,java.lang.Long> guessTypes)Guess types are used to calculate how long an attack would take using that method using guesses/sec.ConfigurationBuildersetLeetTable(java.util.Map<java.lang.Character,java.lang.Character[]> leetTable)The leet table is used to check within a password for common character substitutions (e.g.ConfigurationBuildersetLocale(java.util.Locale locale)Supported locales are en, and fr.ConfigurationBuildersetMinimumEntropy(java.lang.Double minimumEntropy)Used to check if the password is secure enough, and give feedback if not.ConfigurationBuildersetMinimumEntropy(java.math.BigDecimal seconds_to_crack, java.lang.String guess_type)Sets the minimum entropy based on time to crack, and a specific guess type.ConfigurationBuildersetPasswordMatchers(java.util.List<PasswordMatcher> passwordMatchers)PasswordMatcherare what look for different patterns within the password and create an associatedMatchobject.ConfigurationBuildersetYearPattern(java.util.regex.Pattern yearPattern)Year patterns are used to look for years within a password.
-
Constructor Details
-
ConfigurationBuilder
public ConfigurationBuilder()
-
-
Method Details
-
getDefaultPasswordMatchers
- Returns:
- Includes all standard password matchers included with Nbvcxz.
-
getMooresMultiplier
public static java.math.BigDecimal getMooresMultiplier()Returns the Moore's law multiplier we're using for getDefaultGuessTypes(). We will only return a multiplier greater than 1 if it has been more than year since we've updated the constants. The date for this function is: 2018-08-01- Returns:
- the Moore's Law multiplier
-
getDefaultGuessTypes
public static java.util.Map<java.lang.String,java.lang.Long> getDefaultGuessTypes(java.lang.Long crackingHardwareCost)This list was compiled in August 2018 using a baseline of what could be bought for roughly $20k usd for the offline attack values.In the case this library is no longer maintained (or you choose to stay on an old version of it), we will scale the existing values by Moore's law.
- Parameters:
crackingHardwareCost- the hardware cost (USD) to scale the guesses per second- Returns:
- The default list of guess types and associated values of guesses per second.
-
getDefaultGuessTypes
public static java.util.Map<java.lang.String,java.lang.Long> getDefaultGuessTypes()This list was compiled in August 2018 using a baseline of what could be bought for roughly $20k usd for the offline attack values.In the case this library is no longer maintained (or you choose to stay on an old version of it), we will scale the existing values by Moore's law.
- Returns:
- The default list of guess types and associated values of guesses per second.
-
getDefaultDictionaries
- Returns:
- Returns all the dictionaries included with Nbvcxz. Namely there is a dictionary for common passwords, english male names, english female names, english surnames, and common english words.
-
getDefaultAdjacencyGraphs
- Returns:
- Default keyboard adjacency graphs for standard querty, standard keypad, and mac keypad
-
getDefaultLeetTable
public static java.util.Map<java.lang.Character,java.lang.Character[]> getDefaultLeetTable()- Returns:
- The default table of common english leet substitutions
-
getDefaultYearPattern
public static java.util.regex.Pattern getDefaultYearPattern()- Returns:
- The default pattern for years includes years 1900-2029
-
getDefaultMinimumEntropy
public static double getDefaultMinimumEntropy()- Returns:
- The default value for minimum entropy is 35.
-
getDefaultDistanceCalc
public static java.lang.Boolean getDefaultDistanceCalc()- Returns:
- the default is false
-
getDefaultCombinationAlgorithmTimeout
public static long getDefaultCombinationAlgorithmTimeout()- Returns:
- The default value for combination algorithm timeout is 500 (ms).
-
getDefaultCrackingHardwareCost
public static long getDefaultCrackingHardwareCost()- Returns:
- The default value for hardware cost is 20000 usd.
-
setPasswordMatchers
PasswordMatcherare what look for different patterns within the password and create an associatedMatchobject.
Users of this library can implement their ownPasswordMatcherandMatchclasses, here is where you would register them.- Parameters:
passwordMatchers- List of matchers- Returns:
- Builder
-
setGuessTypes
public ConfigurationBuilder setGuessTypes(java.util.Map<java.lang.String,java.lang.Long> guessTypes)Guess types are used to calculate how long an attack would take using that method using guesses/sec.- Parameters:
guessTypes- key is a description of the type of guess, value is how many guesses per second- Returns:
- Builder
-
setDictionaries
Dictionaries are used by theDictionaryMatcherto find common words, names, and known passwords within the password.- Parameters:
dictionaries- List of dictionaries- Returns:
- Builder
-
setAdjacencyGraphs
AdjacencyGraphs are used to find spacial patterns within passwords (e.g. asdfghj).- Parameters:
adjacencyGraphs- List of adjacencyGraphs- Returns:
- Builder
-
setLeetTable
public ConfigurationBuilder setLeetTable(java.util.Map<java.lang.Character,java.lang.Character[]> leetTable)The leet table is used to check within a password for common character substitutions (e.g. s to $).- Parameters:
leetTable- Map for leetTable- Returns:
- Builder
-
setYearPattern
Year patterns are used to look for years within a password.- Parameters:
yearPattern- Pattern for year matching- Returns:
- Builder
-
setMinimumEntropy
Used to check if the password is secure enough, and give feedback if not.- Parameters:
minimumEntropy- Value for minimumEntropy (should be a positive value)- Returns:
- Builder
-
setMinimumEntropy
public ConfigurationBuilder setMinimumEntropy(java.math.BigDecimal seconds_to_crack, java.lang.String guess_type)Sets the minimum entropy based on time to crack, and a specific guess type.
If you are specifying a cracking hardware cost, you should set that prior to calling this.- Parameters:
seconds_to_crack- Value in seconds that you want to consider the minimum for a password to be considered goodguess_type- The guess type to use to figure out what the guesses per second are for this calculation- Returns:
- Builder
-
setLocale
Supported locales are en, and fr.
Default locale is en.- Parameters:
locale- Locale for localization- Returns:
- Builder
-
setDistanceCalc
Distance based dictionary calculations which provide support for misspelling detection, at the expense of performance. This will slow down calculations by an order of magnitude.- Parameters:
distanceCalc- true to enable distance based dictionary calculations- Returns:
- Builder
-
setCombinationAlgorithmTimeout
public ConfigurationBuilder setCombinationAlgorithmTimeout(java.lang.Long combinationAlgorithmTimeout)Timeout for the findBestCombination algorithm. If there are too many possible matches at each position of the password, the algorithm can take too long to get an answer and we must fall back to a simpler algorithm.To disable the findBestMatches calculation and always fall back to the faster, less accurate one, set to 0.
- Parameters:
combinationAlgorithmTimeout- The time in ms to timeout- Returns:
- Builder
-
setCrackingHardwareCost
Sets the cost of cracking hardware to scale the guesses / second for the default guess types.
Does not have any affect if you manually specify the guess types.- Parameters:
crackingHardwareCost- The hardware cost in USD- Returns:
- Builder
-
createConfiguration
Creates theConfigurationobject using all values set in this builder, or default values if unset.- Returns:
- Configuration object from builder
-