diff --git a/common_password_frequency.txt b/common_password_frequency.txt new file mode 100644 index 0000000000000000000000000000000000000000..a802016f3902afc8647b468608957cca1de4e7c5 --- /dev/null +++ b/common_password_frequency.txt @@ -0,0 +1,46 @@ +e +a +r +o +n +i +s +t +l +c +d +m +h +g +b +u +p +1 +y +k +f +w +2 +v +j +3 +z +0 +4 +5 +9 +6 +x +7 +8 +q +* +? +. +- ++ +& +\ +' +; +! diff --git a/common_password_statistics.py b/common_password_statistics.py index 140f6e595ac663ea7cbd03ba57e7d2456ffd5e5b..19a8e1877ed3bbf55672ff60e0e452779a88b04b 100644 --- a/common_password_statistics.py +++ b/common_password_statistics.py @@ -100,7 +100,7 @@ def get_character_frequencies(): f.close() # create_common_password_substitutions() -# get_character_frequencies() +get_character_frequencies() def write_out_common_substitutions(): f = open("common_subs.txt", "w") @@ -114,4 +114,4 @@ def write_out_common_substitutions(): f.write("\n") f.close() -write_out_common_substitutions() \ No newline at end of file +# write_out_common_substitutions() \ No newline at end of file diff --git a/four_password_strategy.c b/four_password_strategy.c index 82245c3088953caca339ff0a2d2cee369991c013..30c622a3298f22ca46c02e4e2928e768c427e48f 100644 --- a/four_password_strategy.c +++ b/four_password_strategy.c @@ -32,7 +32,7 @@ void brute_force_four(HashTable *ht, Passwords* solved){ BYTE guess[32]; sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", brute_guess, hash); add_new_cracked(solved, brute_guess); // Tries generating guesses with common substituions for guessed password @@ -41,6 +41,9 @@ void brute_force_four(HashTable *ht, Passwords* solved){ return; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", brute_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ @@ -93,7 +96,7 @@ int popular_character_guess_four(HashTable *ht, Passwords* solved){ sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); // Checks if guess matched password hash - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", brute_guess, hash); add_new_cracked(solved, brute_guess); //Finds common substituion guesses @@ -102,6 +105,9 @@ int popular_character_guess_four(HashTable *ht, Passwords* solved){ return 0; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", brute_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ @@ -128,7 +134,7 @@ int generate_guesses_four(HashTable *ht, Passwords* solved){ sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); // Checks for matching password - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", line, hash); add_new_cracked(solved, line); // Checks for common substituion with guessed password @@ -137,6 +143,9 @@ int generate_guesses_four(HashTable *ht, Passwords* solved){ return 0; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", line); + } made_guess(solved); free(hex_guess); } diff --git a/passwords.c b/passwords.c index 144b3e6c89c21e7a7ea6d2eb50b1e8d766204beb..59d82765ec27dfd71f83d188dc6712b7ed7188c4 100644 --- a/passwords.c +++ b/passwords.c @@ -129,10 +129,13 @@ int generate_common_subs_four(Passwords* solved, HashTable *ht){ sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); // Checks if password cracked - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", sub_guess, hash); add_new_cracked(solved, sub_guess); } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", sub_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ @@ -215,10 +218,13 @@ int generate_common_subs_six(Passwords* solved, HashTable *ht){ sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); // Checks if found a password - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", sub_guess, hash); add_new_cracked(solved, sub_guess); } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", sub_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ diff --git a/six_password_strategy.c b/six_password_strategy.c index 38b949cce8aa3109b211e5354e8f0a590b2317d1..8aa28ab6dfb099433539c1f2e1a9177867f8c8b6 100644 --- a/six_password_strategy.c +++ b/six_password_strategy.c @@ -37,7 +37,7 @@ void brute_force_six(HashTable *ht, Passwords *solved){ BYTE guess[32]; sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <= -1){ printf("%s %d\n", brute_guess, hash); add_new_cracked(solved, brute_guess); // Tries generating guesses with common substituions for guessed password @@ -46,6 +46,9 @@ void brute_force_six(HashTable *ht, Passwords *solved){ return; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", brute_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ @@ -100,8 +103,8 @@ int popular_character_guess_six(HashTable *ht, Passwords *solved){ BYTE guess[32]; sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); - // Checks if guess matched password hash - if ((hash = hash_table_get(ht, hex_guess))>0){ + // Checks if guess matched password hash get_remaining_guesses(solved) <=-1 + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", brute_guess, hash); add_new_cracked(solved, brute_guess); //Finds common substituion guesses @@ -110,6 +113,9 @@ int popular_character_guess_six(HashTable *ht, Passwords *solved){ return 0; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", brute_guess); + } free(hex_guess); made_guess(solved); if (remaining_hashes(ht) == 0 || get_remaining_guesses(solved) == 0){ @@ -142,7 +148,7 @@ int generate_guesses_six(char* file_name, HashTable *ht, Passwords *solved){ sha256_final(&ctx, guess); char* hex_guess = sha256_byteToHexString(guess); // Checks for matching password - if ((hash = hash_table_get(ht, hex_guess))>0){ + if ((hash = hash_table_get(ht, hex_guess))>0 && get_remaining_guesses(solved) <=-1){ printf("%s %d\n", line, hash); add_new_cracked(solved, line); // Checks for common substituion with guessed password @@ -151,6 +157,9 @@ int generate_guesses_six(char* file_name, HashTable *ht, Passwords *solved){ return 0; } } + else if (get_remaining_guesses(solved) >0){ + printf("%s\n", line); + } made_guess(solved); free(hex_guess); }