diff --git a/crack.c b/crack.c index 93e6b979549facb41c8e399070a4b30b91acee37..a3f79e7a694c7b5c4886e10c7ca62395041bd6a6 100644 --- a/crack.c +++ b/crack.c @@ -113,7 +113,7 @@ void variations(char * word_list_file, int hashes[30][32]) { } void printRandomString1(int k) { - for (int i = 0; i < k - 1; ++i) { + for (int i = 0; i < k ; ++i) { BYTE res[6]; for (int j = 0; j < 6; j++) res[j] = (rand() % 59) + 65;; @@ -165,117 +165,7 @@ void bruteforce(int hashes[30][32]) { } } } -// C program to print all permutations with duplicates allowed - -/* Function to swap values at two pointers */ -void swap(char * x, char * y) { - char temp; - temp = * x; - * x = * y; - * y = temp; -} -/* Function to print permutations of string -This function takes three parameters: -1. String -2. Starting index of the string -3. Ending index of the string. */ -void permute(char * a, int l, int r, int hashes[30][32], int status) { - SHA256_CTX ctx; - BYTE buffer[SHA256_BLOCK_SIZE]; - bool cracked = true; - int count1 = 0; - char word[30]; - - int i; - if (l == r) { - if (status != 2) { - BYTE n[6]; - for (int k = 0; k < 6; ++k) { - n[k] = a[k]; - - } - n[6] = '\0'; - sha256_init( & ctx); - sha256_update( & ctx, n, sizeof(n)); - sha256_final( & ctx, buffer); - - for (int j = 10; j < 30; j++) { - - cracked = true; - for (int i = 0; i < 32; i++) { - if (buffer[i] != hashes[j][i]) { - - cracked = false; - break; - } - } - if (cracked == true && exist[j + 1] != 1) { - ctx.data[6] = '\0'; - exist[j + 1] = 1; - printf("%s %d\n", ctx.data, j + 1); - } - } - } else { - BYTE n[6]; - int count1 = 0; - for (int k = 0; k < 6; ++k) { - n[k] = a[k]; - if (old[k] == n[k]) { - ++count1; - } - - } - - n[6] = '\0'; - if (count1 < 6) { - printf("%s\n", n); - for (int k = 0; k < 7; ++k) { - old[k] = n[k]; - - } - } - - } - } else { - for (i = l; i <= r; i++) { - swap((a + l), (a + i)); - permute(a, l + 1, r, hashes, status); - swap((a + l), (a + i)); //backtrack - } - } -} - -/* Driver program to test above functions */ -void permutations1(char * word_list_file, int hashes[30][32], int status) { - SHA256_CTX ctx; - BYTE buffer[SHA256_BLOCK_SIZE]; - BYTE password[12]; - bool cracked = true; - - char word[30]; - - FILE * word_list; - word_list = fopen(word_list_file, "rb"); - - while (fgets(password, 7, word_list) != '\0') { - - for (int i = 6; i < 12; ++i) { - if (password[i - 6] >= 65 && password[i - 6] < 90) { - password[i] = password[i - 6] + 32; - } else { - password[i] = password[i - 6] - 32; - } - - } - - password[12] = '\0'; - - permute(password, 0, 11, hashes, status); - - } - fclose(word_list); -} void crack6(char * word_list_file, int hashes[30][32]) { SHA256_CTX ctx; @@ -361,7 +251,6 @@ int main(int argc, char * argv[]) { } if (argc == 2) { int k = atoi(argv[1]); - printf("%d\n", k); printRandomString1(k); } @@ -524,7 +413,8 @@ void makeguess(char * word_list, int hashes[][32], int a) { } } - for (int i = 0; i < 100000000000000000; ++i) { + + for (int i = 0; i < 100000000000000000; ++i) { if (count == a) { break; } @@ -555,6 +445,10 @@ void makeguess(char * word_list, int hashes[][32], int a) { } } + + + + len=0; } diff --git a/crack.exe b/crack.exe index a3817294e441f955c9f0db15c9c3d71958c828ac..8ac542f248640bbef07c9380eaf9143177d7afe1 100644 Binary files a/crack.exe and b/crack.exe differ