diff --git a/decrypt.c b/decrypt.c index 48dd94e26a7368e81b51a8bdf91c5621425d3fa2..55a2dc9fb642cdc7f7336c1293947593f9753f2c 100644 --- a/decrypt.c +++ b/decrypt.c @@ -39,9 +39,13 @@ int read_hash_file_four(char *file_name, int n_guesses){ while((c = getc(file)) != EOF){ n +=sprintf(hashes+n,"%02x", c); } + // printf("%s",hashes); char **words = store_password_hashes(hashes); HashTable *password_hashes = new_hash_table(strlen(hashes)/64); + for(int i=0; i < strlen(hashes)/64; i++){ + hash_table_put(password_hashes, words[i], (i+1)); + }; Passwords *cracked_passwords = create_passwords(strlen(hashes)/64, n_guesses); // Tries cracking passwords based on common passwords @@ -83,7 +87,7 @@ void read_hash_file_six(char *file_name, int n_guesses){ //creates hashtable of # of passwords HashTable *password_hashes = new_hash_table(strlen(hashes)/64); for(int i=0; i < strlen(hashes)/64; i++){ - hash_table_put(password_hashes, words[i], (i+1)); + hash_table_put(password_hashes, words[i], (i+10+1)); }; Passwords *cracked_passwords = create_passwords(strlen(hashes)/64, n_guesses); // Tries cracking passwords based on common passwords @@ -103,8 +107,7 @@ void read_hash_file_six(char *file_name, int n_guesses){ void check_hashed_passwords(char *password_list, int n_guesses,char *file_name){ /** - * Reads a file_name containing hashed passwords of assumed length 6 and a list - * of plaint text passwords which it is checked against + * Reads a file_name containing hashed passwords of assumed length 6 and a list of plaint text passwords which it is checked against * */ FILE *file; file = fopen(file_name, "r"); @@ -120,6 +123,9 @@ void check_hashed_passwords(char *password_list, int n_guesses,char *file_name){ //creates hashtable of # of passwords HashTable *password_hashes = new_hash_table(strlen(hashes)/64); + for(int i=0; i < strlen(hashes)/64; i++){ + hash_table_put(password_hashes, words[i], (i+1)); + }; // Passwords to check against hashes FILE* pwrd_file = fopen(password_list, "r"); char line[100000]; @@ -155,6 +161,7 @@ int main(int argc, char *argv[]){ } else if(argc == 2){ int n_guesses = atoi(argv[argc-1]); + // have n amount of guesses n_guesses = read_hash_file_four("pwd4sha256", n_guesses); if (n_guesses>0){ diff --git a/dh.c b/dh.c index 2f8e70126d788a8f5194c8396f092d22d9ae0421..3e5d1ebd13da2870eb8badc17c3c060cb5d1a809 100644 --- a/dh.c +++ b/dh.c @@ -35,17 +35,12 @@ int main(int argc, char *argv[]){ char buffer[256]; - if (argc < 3) - { - fprintf(stderr, "usage %s hostname port\n", argv[0]); - exit(EXIT_FAILURE); - } - int b = atoi(argv[2]); + int b = atoi(argv[1]); portno = 7800; /* Translate host name into peer's IP address ; * This is name translation service by the operating system */ - server = gethostbyname(argv[1]); + server = gethostbyname("172.26.37.44"); if (server == NULL) { @@ -66,7 +61,6 @@ int main(int argc, char *argv[]){ /* Create TCP socket -- active open * Preliminary steps: Setup: creation of active open socket */ sockfd = socket(AF_INET, SOCK_STREAM, 0); - printf("created scoket\n"); if (sockfd < 0) { perror("ERROR opening socket"); @@ -121,7 +115,7 @@ int main(int argc, char *argv[]){ } n = write(sockfd, "\n", 1); n = read(sockfd, buffer, 255); - printf("response message is %s\n", buffer); + printf("%s\n", buffer); close(sockfd); return 0; diff --git a/found_pwds.txt b/found_pwds.txt new file mode 100644 index 0000000000000000000000000000000000000000..800f38f51ebff7197bd20aba2932abf5b8bc1576 --- /dev/null +++ b/found_pwds.txt @@ -0,0 +1,21 @@ +nirm 7 +n1rM 1 +iron 6 +poon 9 +answ 5 +ichi 4 +ich! 3 +Ichi 2 +laff 8 +psnn 10 +nirmal 24 +victor 30 +braves 15 +Braves 19 +BraveS 25 +calvin 20 +calv!n 28 +redbul 23 +sander 11 +saNder 18 +SaNder 27 \ No newline at end of file