Package adams.core.password
Class BruteForcePasswordGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.password.AbstractPasswordGenerator
-
- adams.core.password.BruteForcePasswordGenerator
-
- All Implemented Interfaces:
LoggingLevelHandler,LoggingSupporter,PasswordGenerator,SizeOfHandler,Serializable,Iterator<String>
public class BruteForcePasswordGenerator extends AbstractPasswordGenerator
Generates passwords for a brute force attack.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected char[]m_Charsthe characters to use in the attack.protected int[]m_Countercounter for generating the passwords.protected intm_Maxthe maximum number of characters.protected intm_MaxLengththe maximum length for passwords to test.protected Stringm_Nextthe next password.protected booleanm_NextGeneratedwhether the next password has already been generated.protected intm_NumCharsthe current number of characters in the password.protected char[]m_Passwordthe buffer for the password.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description BruteForcePasswordGenerator(String chars, int maxLength)Initializes the generator.BruteForcePasswordGenerator(String chars, int maxLength, String start)Initializes the generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringdoNext()Generates the next password.booleanhasNext()Checks whether there is another password available.Stringnext()Returns the next password.-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
-
-
-
Field Detail
-
m_MaxLength
protected int m_MaxLength
the maximum length for passwords to test.
-
m_Counter
protected int[] m_Counter
counter for generating the passwords.
-
m_Chars
protected char[] m_Chars
the characters to use in the attack.
-
m_Max
protected int m_Max
the maximum number of characters.
-
m_Password
protected char[] m_Password
the buffer for the password.
-
m_NumChars
protected int m_NumChars
the current number of characters in the password.
-
m_Next
protected String m_Next
the next password.
-
m_NextGenerated
protected boolean m_NextGenerated
whether the next password has already been generated.
-
-
Constructor Detail
-
BruteForcePasswordGenerator
public BruteForcePasswordGenerator(String chars, int maxLength)
Initializes the generator.- Parameters:
chars- the characters to use for each positionmaxLength- the maximum length of the password
-
BruteForcePasswordGenerator
public BruteForcePasswordGenerator(String chars, int maxLength, String start)
Initializes the generator.- Parameters:
chars- the characters to use for each positionmaxLength- the maximum length of the passwordstart- the starting password, use null to start from scratch
-
-
Method Detail
-
hasNext
public boolean hasNext()
Checks whether there is another password available.- Specified by:
hasNextin interfaceIterator<String>- Specified by:
hasNextin classAbstractPasswordGenerator- Returns:
- true if another password available
-
next
public String next()
Returns the next password.- Specified by:
nextin interfaceIterator<String>- Specified by:
nextin classAbstractPasswordGenerator- Returns:
- the next password, null if no more available
-
doNext
protected String doNext()
Generates the next password.- Returns:
- the next password, null if no more available
-
-