Skip to content
Snippets Groups Projects
Commit fe60ed1f authored by ChouTatsumi's avatar ChouTatsumi
Browse files

test pwd6

parent e3a4e66a
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
#define OUTPUT_FILENAME "found_pwds.txt"
#define PWD4_NUMBERS 10
#define PWD_NUMBERS 30
#define PWD4_LEN 4
#define PWD6_LEN 6
#define ASCII_FROM 32
#define ASCII_TO 126
......@@ -73,45 +75,125 @@ int main(int argc, char** argv) {
// create guess and check it
SHA256_CTX ctx;
BYTE buf[SHA256_BLOCK_SIZE];
int checked[PWD_NUMBERS];
int_array_init(checked, PWD4_NUMBERS);
// open output file
fp = fopen(OUTPUT_FILENAME, "w");
// violent crack PWD4
char guess[5];
guess[4] = '\0';
int checked[PWD4_NUMBERS];
int_array_init(checked, PWD4_NUMBERS);
char pw4guess[PWD4_LEN + 1];
pw4guess[PWD4_LEN] = '\0';
int first, second, third, fourth;
for (first = ASCII_FROM; first <= ASCII_TO; first++) {
guess[0] = first;
pw4guess[0] = first;
for (second = ASCII_FROM; second <= ASCII_TO; second++) {
guess[1] = second;
pw4guess[1] = second;
for (third = ASCII_FROM; third <= ASCII_TO; third++) {
guess[2] = third;
pw4guess[2] = third;
for (fourth = ASCII_FROM; fourth <= ASCII_TO; fourth++) {
guess[3] = fourth;
pw4guess[3] = fourth;
// generate hash and check
sha256_init(&ctx);
sha256_update(&ctx, (BYTE*)guess, 4);
sha256_update(&ctx, (BYTE*)pw4guess, PWD4_LEN);
sha256_final(&ctx, buf);
for (int i = 0; i < PWD4_NUMBERS; i++) {
for (i = 0; i < PWD4_NUMBERS; i++) {
if (!checked[i] && !memcmp(pwd[i], buf, SHA256_BLOCK_SIZE)) {
checked[i] = 1;
printf("%s %d\n", guess, i + 1);
fprintf(fp, "%s %d\n", guess, i + 1);
printf("%s %d\n", pw4guess, i + 1);
fprintf(fp, "%s %d\n", pw4guess, i + 1);
}
}
}}}}
// crack PWD6
char pw6guess[PWD6_LEN + 1];
pw6guess[PWD6_LEN] = '\0';
int fifth, sixth;
// guess pure number password
for (first = ASCII_NUM_FROM; first <= ASCII_NUM_TO; first++) {
pw6guess[0] = first;
for (second = ASCII_NUM_FROM; second <= ASCII_NUM_TO; second++) {
pw6guess[1] = second;
for (third = ASCII_NUM_FROM; third <= ASCII_NUM_TO; third++) {
pw6guess[2] = third;
for (fourth = ASCII_NUM_FROM; fourth <= ASCII_NUM_TO;
fourth++) {
pw6guess[3] = fourth;
for (fifth = ASCII_NUM_FROM; fifth <= ASCII_NUM_TO;
fifth++) {
pw6guess[4] = fifth;
for (sixth = ASCII_NUM_FROM; sixth <= ASCII_NUM_TO;
sixth++) {
pw6guess[5] = sixth;
// generate hash and check
sha256_init(&ctx);
sha256_update(&ctx, (BYTE*)pw6guess, PWD6_LEN);
sha256_final(&ctx, buf);
for (i = PWD4_NUMBERS; i < PWD_NUMBERS; i++) {
if (!checked[i] &&
!memcmp(pwd[i], buf,
SHA256_BLOCK_SIZE)) {
checked[i] = 1;
printf("%s %d\n", pw6guess, i + 1);
fprintf(fp, "%s %d\n", pw6guess, i + 1);
}
}
}}}}}}
// guess pure lowercase alphabets password, and first letter Capitalize
for (first = ASCII_LOWERCASE_FROM; first <= ASCII_LOWERCASE_TO; first++) {
pw6guess[0] = first;
for (second = ASCII_LOWERCASE_FROM; second <= ASCII_LOWERCASE_TO; second++) {
pw6guess[1] = second;
for (third = ASCII_LOWERCASE_FROM; third <= ASCII_LOWERCASE_TO; third++) {
pw6guess[2] = third;
for (fourth = ASCII_LOWERCASE_FROM; fourth <= ASCII_LOWERCASE_TO;
fourth++) {
pw6guess[3] = fourth;
for (fifth = ASCII_LOWERCASE_FROM; fifth <= ASCII_LOWERCASE_TO;
fifth++) {
pw6guess[4] = fifth;
for (sixth = ASCII_LOWERCASE_FROM; sixth <= ASCII_LOWERCASE_TO;
sixth++) {
pw6guess[5] = sixth;
// generate hash and check
sha256_init(&ctx);
sha256_update(&ctx, (BYTE*)pw6guess, PWD6_LEN);
sha256_final(&ctx, buf);
for (i = PWD4_NUMBERS; i < PWD_NUMBERS; i++) {
if (!checked[i] &&
!memcmp(pwd[i], buf,
SHA256_BLOCK_SIZE)) {
checked[i] = 1;
printf("%s %d\n", pw6guess, i + 1);
fprintf(fp, "%s %d\n", pw6guess, i + 1);
}
}
// crack PWD6
// first lettle capitalize
pw6guess[0] = first - ASCII_LOWERCASE_FROM + ASCII_UPPERCASE_FROM;
// generate hash and check
sha256_init(&ctx);
sha256_update(&ctx, (BYTE*)pw6guess, PWD6_LEN);
sha256_final(&ctx, buf);
for (i = PWD4_NUMBERS; i < PWD_NUMBERS; i++) {
if (!checked[i] && !memcmp(pwd[i], buf, SHA256_BLOCK_SIZE)) {
checked[i] = 1;
printf("%s %d\n", pw6guess, i + 1);
fprintf(fp, "%s %d\n", pw6guess, i + 1);
}
}
}}}}}}
fclose(fp);
} else if (argc == 2) {
......
......@@ -8,3 +8,4 @@ sp*t 1
spOt 4
spot 5
xunz 8
Terenc 25
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment