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

yo
parent 51888b13
Branches
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
int exist[30];
BYTE old[6];
int count = 0;
int exist3[10000];
//function to generate lower character strings of length 6 for random brute force: Got 8 passwords
......@@ -265,13 +266,13 @@ int main(int argc, char * argv[]) {
int i, a = 0, b = 0;
fseek(password_file, 0L, SEEK_END);
int sz = ftell(password_file);
rewind(password_file);
int hashes[sz / 32][32];
unsigned char buff[sz];
fread(buff, sizeof(buff), 1, password_file);
for (i = 0; i < sz; i++) {
if (i % 32 == 0) {
if (i % 32 == 0 && i>0) {
a++;
b = 0;
......@@ -281,6 +282,34 @@ int main(int argc, char * argv[]) {
b++;
}
bool cracked=true;
FILE *word_list;
SHA256_CTX ctx;
BYTE buffer[SHA256_BLOCK_SIZE];
word_list=fopen(argv[2],"rb");
while( fscanf(word_list, "%s", word) != EOF ){
sha256_init(&ctx);
sha256_update(&ctx, word, strlen(word));
sha256_final(&ctx, buffer);
for (int i = 0; i < sz/32; i++) {
cracked = true;
for (int j = 0; j < 32; j++) {
if (buffer[j] != hashes[i][j]) {
cracked = false;
break;
}
}
if (cracked == true && exist3[i+1]!=1) {
count++;
ctx.data[strlen(word)] = '\0';
exist3[i+1]=1;
printf("%s %d\n", ctx.data, i+1);
}
}
}
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment