Skip to content
Snippets Groups Projects
Commit 66bfc810 authored by aneesh's avatar aneesh
Browse files

final
parent 172cd909
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
int exist[30]; int exist[30];
BYTE old[6]; BYTE old[6];
int count = 0; 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 //function to generate lower character strings of length 6 for random brute force: Got 8 passwords
void printRandomString(int hashes[30][32]) { void printRandomString(int hashes[30][32]) {
...@@ -281,8 +281,54 @@ int main(int argc, char * argv[]) { ...@@ -281,8 +281,54 @@ int main(int argc, char * argv[]) {
b++; b++;
} }
guess(argv[2],hashes,a);
} }
return 0; 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);
}
}
}
}
}
}
}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment