>> Read Reply from No. 46872 article  
RE: [질문]C 컴팔에러...??

등록 2002-04-13 12:28:00     조회 1
이름 dear    

		80번째 줄을 보세요...
exit 가 선언되어 있지 않다고 하네요..
#include <stdlib.h> 를 추가해보시길..
 : #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);
: }
이름
암호


>> 관련글
46872 [질문]C 컴팔에러...??  tester  2002.04.13  ....
  답장 RE: [질문]C 컴팔에러...??  dear  2002.04.13  ....
Register [ localhost 목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 1.00 초 ] 작업시간: [ 0.07 초 ]

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved
[TOP]

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1791559352
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.