>> Edit article
이름
제목
패스워드
#gcc-o decrypt decrypt.cpp -lcrypt 로 컴팔을 하는데요... decrypt.cpp : In function 'void decrypt (char *)': decrypt.cpp:80: 'exit'undeclared(first use thid function) decrypt.cpp:80: (Each undeclared identifier is reported only once for each function it appears in.) 이란 메세지만 나오네요... 고수님 들 알려주세요... redhat 7.2에서 돌렸구요... DES알고리즘으로 encrypt암호 푸는 소스입니다만.. 아래는 decrypt.cpp 소스입니다.. /*---------------------------------------------------------------------------------- Program : DES algorithm으로 crypt된 password 때려맞추는 program의 C 언어 version ----------------------------------------------------------------------------------*/ #include <stdio.h> #include <string.h> #include <crypt.h> // 현재 이 프로그램은 소문자와 숫자의 아스키 코드만을 이용하여 크래킹을 함. #define ASCII_ARRAY "abcdefghijklmnopqrstuvwxyz0123456789" // 대소문자와 특수문자까지 ... //#define ASCII_ARRAY "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`~!@#$%^&*()-_=+|,<.>/?;:'"[{]}" // 함수선언 void print_info(); void decrypt(char *crypt_passwd); void save_file(char *encrypted_password, char *decrypted_password); ///////////////////////////////////////////////////////////// /// Main function ///////////////////////////////////////////////////////////// int main(int argc, char *argv[]) { // 본 프로그램의 간략한 설명을 출력하는 function 호출 print_info(); // argument가 제대로 입력된 경우에는 크래킹을 시작하고, 그렇지 않으면 에러 메세지 출력. if (argc == 2) { // 크래킹하는 function 호출 decrypt(argv[1]); } else { printf("Usage: decrypt [crypt password] (ex: decrypt e23zaAJLCLuXU)");; } return 0; } ///////////////////////////////////////////////////////////// /// Sub-functions ///////////////////////////////////////////////////////////// // 본 프로그램의 간략한 설명 출력하는 function void print_info() { printf("Unix DES 암호 크랙 프로그램 Ver. 1.0"); printf("Copyleft 2000 (C) Mod777"); } // argument로 넘어온 crypt된 암호(*crypt_passwd)를 때려맞추는 function // 암호가 풀린 경우에 그 암호를 출력하고 끝냄. void decrypt(char *crypt_passwd) { char test[64], salt[3]; // salt 값 추출. 이 값은 crypt된 암호의 처음 2 byte이다. salt[0] = crypt_passwd[0]; salt[1] = crypt_passwd[1]; salt[2] = 0; // ASCII 코드 조합에 사용될 문자들의 집합을 문자배열에 입력함. char ascii[] = ASCII_ARRAY; // 조합에 사용될 문자들의 총 갯수. int count = strlen(ascii); // 1문자 암호 크래킹 for (int i=0; i<count; i++) { test[0] = ascii[i]; test[1] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } // 2문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } // 3문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } // 4문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { for (int l=0; l<count; l++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = ascii[l]; test[4] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } } // 5문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { for (int l=0; l<count; l++) { for (int m=0; m<count; m++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = ascii[l]; test[4] = ascii[m]; test[5] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } } } // 6문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { for (int l=0; l<count; l++) { for (int m=0; m<count; m++) { for (int n=0; n<count; n++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = ascii[l]; test[4] = ascii[m]; test[5] = ascii[n]; test[6] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } } } } // 7문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { for (int l=0; l<count; l++) { for (int m=0; m<count; m++) { for (int n=0; n<count; n++) { for (int o=0; o<count; o++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = ascii[l]; test[4] = ascii[m]; test[5] = ascii[n]; test[6] = ascii[o]; test[7] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } } } } } // 8문자 암호 크래킹 for (int i=0; i<count; i++) { for (int j=0; j<count; j++) { for (int k=0; k<count; k++) { for (int l=0; l<count; l++) { for (int m=0; m<count; m++) { for (int n=0; n<count; n++) { for (int o=0; o<count; o++) { for (int p=0; p<count; p++) { test[0] = ascii[i]; test[1] = ascii[j]; test[2] = ascii[k]; test[3] = ascii[l]; test[4] = ascii[m]; test[5] = ascii[n]; test[6] = ascii[o]; test[7] = ascii[p]; test[8] = 0; if (strcmp(crypt(test, salt), crypt_passwd) == 0) { printf("Congratulations! The password is <%s>.", test); // 외부 파일에서 기록하고 끝냄. save_file(crypt_passwd, test); exit(0); } printf("%s", test); } } } } } } } } printf("암호를 깰수 없었습니다. 확장된 크래킹을 위해 ReadMe.txt를 참고해 주십시오."); } // Decrypted password를 외부 file에 저장하는 function // Encrypted password를 저장될 file name으로 하고, 그 파일 안에 Decrypted password를 기록한다. void save_file(char *encrypted, char *decrypted) { FILE *ofp; char filename[48]; ofp = fopen("decrypted.txt", "a"); fprintf(ofp, "%s - %s", encrypted, decrypted); fclose(ofp); }
Copyleft
1999-2026 by
JSBoard Open Project
Theme Designed by
IDOO
All right reserved