
04.08.2007, 02:00
|
|
Постоянный
Регистрация: 06.12.2006
Сообщений: 762
Провел на форуме: 5352530
Репутация:
2062
|
|
Генератор Keyboard для секции внешних переборщиков. Позволяет находить пароли состоящие из последовательностей символов (включая спецсимволы), типа:
6ujij,.
6ujij,j
6ujij,k
6ujij,l
6ujijmn
p[-[p[;
p[-[p98
p[-[p90
p[-[p9p
Код:
[List.External:Keyboard]
int maxlength, length; // Maximum passwords length to try, current length
int fuzz; // The desired "fuzz factor", either 0 or 1
int id[15]; // Current character indices for each position
int m[0x400], mc[0x80]; // The keys matrix, counts of adjacent keys
int f[0x40], fc; // Characters for the first position, their count
void init()
{
int minlength;
int i, j, c, p;
int k[0x40];
minlength = 7; // Initial passwords length to try
maxlength = 9; // Maximum passwords length to try, up to 15
fuzz = 1; // "Fuzz factor", set to 0 for much quicker runs
/*
* This defines the keyboard layout, by default for a QWERTY keyboard.
* Please note that the sizes of m[] and mc[] arrays assume 7-bit
* characters and will need to be doubled for 8-bit characters such as
* umlauts.
*/
i = 0; while (i < 0x40) k[i++] = 0;
k[0] = '`';
i = 0; while (++i <= 9) k[i] = '0' + i;
k[10] = '0'; k[11] = '-'; k[12] = '=';
k[0x11] = 'q'; k[0x12] = 'w'; k[0x13] = 'e'; k[0x14] = 'r';
k[0x15] = 't'; k[0x16] = 'y'; k[0x17] = 'u'; k[0x18] = 'i';
k[0x19] = 'o'; k[0x1a] = 'p'; k[0x1b] = '['; k[0x1c] = ']';
k[0x1d] = '\\';
k[0x21] = 'a'; k[0x22] = 's'; k[0x23] = 'd'; k[0x24] = 'f';
k[0x25] = 'g'; k[0x26] = 'h'; k[0x27] = 'j'; k[0x28] = 'k';
k[0x29] = 'l'; k[0x2a] = ';'; k[0x2b] = '\'';
k[0x31] = 'z'; k[0x32] = 'x'; k[0x33] = 'c'; k[0x34] = 'v';
k[0x35] = 'b'; k[0x36] = 'n'; k[0x37] = 'm'; k[0x38] = ',';
k[0x39] = '.'; k[0x3a] = '/';
i = 0; while (i < 0x80) mc[i++] = 0;
fc = 0;
/* rows */
c = 0;
i = 0;
while (i < 0x40) {
p = c;
c = k[i++];
if (!c) continue;
f[fc++] = c;
if (!p) continue;
m[(c << 3) + mc[c]++] = p;
m[(p << 3) + mc[p]++] = c;
}
f[fc] = 0;
/* columns */
i = 0;
while (i < 0x30) {
p = k[i++];
if (!p) continue;
j = 1 - fuzz;
while (j <= 1 + fuzz) {
c = k[i + 0x10 - j++];
if (!c) continue;
m[(c << 3) + mc[c]++] = p;
m[(p << 3) + mc[p]++] = c;
}
}
id[0] = 0;
length = minlength;
}
void generate()
{
int i, p, maxcount;
word[i = 0] = p = f[id[0]];
while (++i < length)
word[i] = p = m[(p << 3) + id[i]];
word[i--] = 0;
if (i) maxcount = mc[word[i - 1]]; else maxcount = fc;
while (++id[i] >= maxcount) {
if (!i) {
if (length < maxlength) {
id[0] = 0;
id[length++] = 0;
}
return;
}
id[i--] = 0;
if (i) maxcount = mc[word[i - 1]]; else maxcount = fc;
}
}
void restore()
{
int i;
/* Calculate the length */
length = 0;
while (word[length]) length++;
/* Infer the first character index */
i = -1;
while (++i < fc) {
if (f[i] == word[0]) {
id[0] = i;
break;
}
}
/* This sample can be enhanced to infer the rest of the indices here */
}
|
|
|