diff --git a/crack.c b/crack.c index fa170ed0367fcbbd7174c3ec24a6dbdb5ba80931..67035a5d5e039398e97918a8efb5f1eb56ad20f2 100644 --- a/crack.c +++ b/crack.c @@ -10,7 +10,7 @@ int exist[30]; BYTE old[6]; int count = 0; -void makeguess(char * word_list, int hashes[][32],int a); +void guess(char * word_list, int hashes[][32],int a); //function to generate lower character strings of length 6 for random brute force: Got 8 passwords void printRandomString(int hashes[30][32]) { @@ -281,8 +281,54 @@ int main(int argc, char * argv[]) { b++; } - +guess(argv[2],hashes,a); } return 0; } + +void guess(char * word_list, int hashes[][32], int a) { + + BYTE buffer[SHA256_BLOCK_SIZE]; + SHA256_CTX ctx; + BYTE password[10]; + bool cracked = true; + + for (int c1 = 32; c1 < 127; c1++) { + password[0] = c1; + if (count == 10) break; + for (int c2 = 32; c2 < 127; c2++) { + password[1] = c2; + if (count == 10) break; + for (int c3 = 32; c3 < 127; c3++) { + password[2] = c3; + if (count == 10) break; + for (int c4 = 32; c4 < 127; c4++) { + if (count == 10) break; + password[3] = c4; + password[4] = '\0'; + + sha256_init( & ctx); + sha256_update( & ctx, password, sizeof(password)); + sha256_final( & ctx, buffer); + + for (int i = 1; i < 11; i++) { + cracked = true; + for (int j = 0; j < 32; j++) { + if (buffer[j] != hashes[i][j]) { + cracked = false; + break; + } + } + if (cracked == true) { + count++; + ctx.data[4] = '\0'; + printf("%s %d\n", ctx.data, i); + } + } + } + } + } + } +} + diff --git a/crack.exe b/crack.exe index bff2de83c5b460c31cea45785cbc05d7b8568329..6672ccd9334ad323f516a3a05474bc230ae6c790 100644 Binary files a/crack.exe and b/crack.exe differ