string-enumerator
0 dependencies
An NPM package for enumerating strings based off of a set of characters. Great for blind brute forcing and fuzzing.
Example
var EnumString = var charset = 'abcd123'; var eString = charset; for var i = 0; i < 20; i++ console // Logs: a b c d 1 2 3 aa ab ac ad a1 a2 a3 ba bb bc bd b1 b2
API
- EnumString.EnumString (Constructor)
- EnumString.prototype.setIndex
- EnumString.prototype.getIndex
- EnumString.prototype.getString
- EnumString.prototype.nextString
- EnumString.prototype.prevString
- EnumString.prototype.getIndexFromStr
- EnumString.letters
- EnumString.digits
- EnumString.symbols
EnumString.EnumString
EnumString.EnumString is the main constructor for the EnumString object, and must be instatiated to utilize this package. The constructor requires that a string or array of characters is passed as the first argument, which dictates the character set that the object will enumerate through.
Syntax:
var charset = 'abcd123'; var eString = charset;
EnumString.prototype.setIndex
Sets the current index of enumeration to a specified number.
Syntax:
eString;
EnumString.prototype.getIndex
Returns the current enumeration index.
Syntax:
eString; console; // Logs "4"
EnumString.prototype.getString
Gets the string identified by the current enumeration index.
Syntax:
// Assuming the charset 'abcd123' eString; console; // Logs 'a' eString; console; // Logs 'b' eString; console; // Logs 'aa'
EnumString.prototype.nextString
Returns the string at index
then increases index by one, for use in loops.
Syntax:
// Assuming the charset 'abcd123' eString; for var i = 0; i < 3; i++ console; // Logs: d 1 2
EnumString.prototype.prevString
Returns the string at index
then decreases index by one, for use in loops.
Syntax:
// Assuming the charset 'abcd123' eString; for var i = 0; i < 3; i++ console; // Logs: ab aa 3
EnumString.prototype.getIndexFromStr
Gets the index that would correspond to the given string.
Syntax:
// Assuming the charset 'abcd123'; console; // Logs: '0' console; // Logs: '5' console; // Logs: '7'
EnumString.letters
A quality of life string containing upper and lowercase letters
Syntax:
console; // Logs: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
EnumString.digits
A quality of life string containing numbers 0-9
Syntax:
console; // Logs: '0123456789'
EnumString.symbols
A quality of life string containing some symbols
Syntax:
console; // Logs: '`~!@#$%^&*()-_=+[{]}|\\;:\'",<.>/?'