|
|
Message-ID: <20080317015307.GA18706@openwall.com>
Date: Mon, 17 Mar 2008 04:53:07 +0300
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: DumbForce external modes for 8-bit characters
Hi,
Here are a couple of variations of the DumbForce external mode. The
first one will try almost the entire 8-bit range, except for most risky
terminal control characters. The other one differs in that it will skip
over lowercase letters, which is desirable when cracking LM hashes.
# Generic implementation of "dumb" exhaustive search, given a range of lengths
# and an arbitrary charset. This is pre-configured to try 8-bit characters,
# which is only reasonable to do for very short passwords.
[List.External:DumbForce-8bit]
int maxlength; // Maximum password length to try
int last; // Last character position, zero-based
int lastid; // Character index in the last position
int id[0x7f]; // Current character indices for other positions
int charset[0x100], c0; // Character set
void init()
{
int minlength;
int i, c;
minlength = 1; // Initial password length to try, must be at least 1
maxlength = 8; // Must be at least same as minlength
/*
* This defines the character set.
*
* Let's say, we want to try TAB, all non-control ASCII characters, and all
* 8-bit characters, including the 8-bit terminal controls range (as these are
* used as regular national characters with some 8-bit encodings), but except
* for known terminal controls (risky for the terminal we may be running on).
*/
i = 0;
charset[i++] = 9; // Add horizontal TAB (ASCII 9), then
c = ' '; // start with space (ASCII 32) and
while (c <= 0x7e) // proceed for all printable ASCII
charset[i++] = c++;
c++; // Skip DEL (ASCII 127) and
while (c < 0x84) // proceed over 8-bit codes till IND
charset[i++] = c++;
charset[i++] = 0x86; // Skip IND (84 hex) and NEL (85 hex)
charset[i++] = 0x87;
c = 0x89; // Skip HTS (88 hex)
while (c < 0x8d) // Proceed till RI (8D hex)
charset[i++] = c++;
c = 0x91; // Skip RI, SS2, SS3, DCS
while (c < 0x96) // Proceed till SPA (96 hex)
charset[i++] = c++;
charset[i++] = 0x99; // Skip SPA, EPA, SOS
c = 0xa0; // Skip DECID, CSI, ST, OSC, PM, APC
while (c <= 0xff) // Proceed with the rest of 8-bit codes
charset[i++] = c++;
/* Zero-terminate it, and cache the first character */
charset[i] = 0;
c0 = charset[0];
last = minlength - 1;
i = 0;
while (i <= last) {
id[i] = 0;
word[i++] = c0;
}
lastid = -1;
word[i] = 0;
}
void generate()
{
int i;
/* Handle the typical case specially */
if (word[last] = charset[++lastid]) return;
lastid = 0;
word[last] = c0;
i = last;
while (i--) { // Have a preceding position?
if (word[i] = charset[++id[i]]) return;
id[i] = 0;
word[i] = c0;
}
if (++last < maxlength) { // Next length?
id[last] = lastid = 0;
word[last] = c0;
} else // We're done
word = 0;
}
void restore()
{
int i, c;
/* Calculate the current length and infer the character indices */
last = 0;
while (c = word[last]) {
i = 0; while (charset[i] != c && charset[i]) i++;
if (!charset[i]) i = 0; // Not found
id[last++] = i;
}
lastid = id[--last];
}
# Generic implementation of "dumb" exhaustive search, given a range of lengths
# and an arbitrary charset. This is pre-configured to try 8-bit characters
# against LM hashes, which is only reasonable to do for very short password
# half lengths.
[List.External:DumbForce-LM]
int maxlength; // Maximum password length to try
int last; // Last character position, zero-based
int lastid; // Character index in the last position
int id[0x7f]; // Current character indices for other positions
int charset[0x100], c0; // Character set
void init()
{
int minlength;
int i, c;
minlength = 1; // Initial password length to try, must be at least 1
maxlength = 7; // Must be at least same as minlength
/*
* This defines the character set.
*
* Let's say, we want to try TAB, all non-control ASCII characters, and all
* 8-bit characters, including the 8-bit terminal controls range (as these are
* used as regular national characters with some 8-bit encodings), but except
* for known terminal controls (risky for the terminal we may be running on).
*
* Also, let's say our hashes are case-insensitive, so skip lowercase letters
* (this is right for LM hashes).
*/
i = 0;
charset[i++] = 9; // Add horizontal TAB (ASCII 9), then
c = ' '; // start with space (ASCII 32) and
while (c < 'a') // proceed till lowercase 'a'
charset[i++] = c++;
c = 'z' + 1; // Skip lowercase letters and
while (c <= 0x7e) // proceed for all printable ASCII
charset[i++] = c++;
c++; // Skip DEL (ASCII 127) and
while (c < 0x84) // proceed over 8-bit codes till IND
charset[i++] = c++;
charset[i++] = 0x86; // Skip IND (84 hex) and NEL (85 hex)
charset[i++] = 0x87;
c = 0x89; // Skip HTS (88 hex)
while (c < 0x8d) // Proceed till RI (8D hex)
charset[i++] = c++;
c = 0x91; // Skip RI, SS2, SS3, DCS
while (c < 0x96) // Proceed till SPA (96 hex)
charset[i++] = c++;
charset[i++] = 0x99; // Skip SPA, EPA, SOS
c = 0xa0; // Skip DECID, CSI, ST, OSC, PM, APC
while (c <= 0xff) // Proceed with the rest of 8-bit codes
charset[i++] = c++;
/* Zero-terminate it, and cache the first character */
charset[i] = 0;
c0 = charset[0];
last = minlength - 1;
i = 0;
while (i <= last) {
id[i] = 0;
word[i++] = c0;
}
lastid = -1;
word[i] = 0;
}
void generate()
{
int i;
/* Handle the typical case specially */
if (word[last] = charset[++lastid]) return;
lastid = 0;
word[last] = c0;
i = last;
while (i--) { // Have a preceding position?
if (word[i] = charset[++id[i]]) return;
id[i] = 0;
word[i] = c0;
}
if (++last < maxlength) { // Next length?
id[last] = lastid = 0;
word[last] = c0;
} else // We're done
word = 0;
}
void restore()
{
int i, c;
/* Calculate the current length and infer the character indices */
last = 0;
while (c = word[last]) {
i = 0; while (charset[i] != c && charset[i]) i++;
if (!charset[i]) i = 0; // Not found
id[last++] = i;
}
lastid = id[--last];
}
--
Alexander Peslyak <solar at openwall.com>
GPG key ID: 5B341F15 fp: B3FB 63F4 D7A3 BCCC 6F6E FC55 A2FC 027C 5B34 1F15
http://www.openwall.com - bringing security into open computing environments
--
To unsubscribe, e-mail john-users-unsubscribe@...ts.openwall.com and reply
to the automated confirmation request that will be sent to you.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.