Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <crypt.h>
- #include <time.h>
- #include <string.h>
- #include <stdlib.h>
- using namespace std;
- /**
- * Password numbers of letters
- */
- #define PASSWORD_MAX_LENGTH 5
- /**
- * Password salt generated
- */
- char password_salt[] = "$6$SRM3J9B1$";
- /**
- * Password hash code
- */
- char password_hash_code[] = "$6$SRM3J9B1$Fk7jQICjeGcPWbNM8FsHCoSQPQ/SjzK/dtzy14oT62haJji6539o9qfD7oMpdkZgfajsQSThHvEvhhATZtIb00";
- /**
- * Password posible letter array
- */
- char charset[] = {'@','#','$','%','^','&','*',',','0','1','2','3','4','5','6','7','8','9','!','a', 'b', 'c', 'd', 'e', 'f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\0'};
- /**
- * The string used for searching the password
- */
- char *actual_password ;
- /**
- * Hash code number of bytes
- */
- unsigned short int hash_code_length ;
- /**
- * Password posible letter array length
- */
- unsigned short int charset_length;
- unsigned int cnt = 10000;
- int check_password_validity(char *verified_password)
- {
- char *password_valid_response = crypt( verified_password , password_salt ) ;
- unsigned int index;
- cnt ++ ;
- if( cnt > 10000 )
- {
- cout << verified_password << endl ;
- cnt = 0;
- }
- for( index = 0 ; index < hash_code_length ; index++ )
- {
- if( password_valid_response[index] != password_hash_code[index] )
- {
- return 0;
- }
- }
- return 1;
- }
- void search(int current_pos)
- {
- unsigned int search_index ;
- char send_password[] = "<:linux_ 0319:>";
- if( current_pos == PASSWORD_MAX_LENGTH )
- {
- strcat(send_password,actual_password);
- if( check_password_validity(send_password) )
- {
- cout << "Done: " << actual_password << endl ;
- while(1)
- {
- search_index = 9 ;
- }
- }
- }
- else
- {
- for(search_index = 0; search_index < charset_length ; search_index++)
- {
- actual_password[current_pos] = charset[search_index] ;
- if( current_pos < PASSWORD_MAX_LENGTH )
- {
- search(current_pos + 1);
- }
- }
- }
- }
- int main( void )
- {
- hash_code_length = strlen(password_hash_code);
- charset_length = strlen(charset);
- actual_password = new char[PASSWORD_MAX_LENGTH];
- actual_password[PASSWORD_MAX_LENGTH] = '\0' ;
- search(0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement