'Category'에 해당되는 글 88건
- 2010.06.30 N모사 카페 채팅 해킹하기 5
- 2010.06.14 Smart phone 'Have the fight of the century' 1
- 2010.06.08 He is more eager for success than me. 1
- 2010.06.05 VC 6.0에서 MASM으로 어셈블 환경 설정
- 2010.05.22 클래스 멤버 메소드를 콜백 함수로 사용하기
- 2010.05.13 메모리에 할당이 되지만 값을 변경할 수 없는 메모리 영역? 1
- 2010.05.04 Keep a diary in about a week
- 2010.04.25 After reading "Don't Eat the Marshmallow"
- 2010.04.25 아주 예전에 만들었던 비행기 게임
- 2010.04.22 Reserve forces training
또다시 오랜만에 포스팅을 하는군요. 하하. 한동안 이것저것 하느라 바빴습니다만.. 이번에는 좀
색다른 시도를 해봤습니다. 제목에서도 알 수 있드시 바로 N모사 카페 채팅을 해킹하기입니다. 후후..
사실 해킹같은 건 별로 경험도 없을 뿐더러 그다지 관심 분야도 아니었습니다만..
최근 들어서 이쪽 분야에 관심이 가기 시작하더군요. 저의 왕성한 호기심을 충분히 그리고 촉촉히
자극하기 시작하였지요. : )
해킹 대상을 물색하던 와중에 떠오르던 것이 제가 가끔씩 애용하는 만화책 카페 채팅방이었습니다.
채팅방을 해킹한다면 왠지 제법 많은 것들을 얻을 것 같다는 생각이 뇌리에 스치더군요.
예를 들어, 카페 로그인없이 채팅 내용을 도청하고 방장 기능을 획득한다거나 아이디 도용 등의
작업들 말입니다. 그동안 나름대로 쌓아왔던 내공과 짬밥을 적절히 활용했습니다.
대략적으로 제가 어떤 작업을 해야할지 감이 오더군요.
카페 채팅 해킹의 핵심은 패킷 스니핑으로 분석하여 암호화된 패킷을 복호화하고 CONNECT와
DISCONNECT에서 발생하는 핸드쉐이킹 인증 작업을 체크하는 것입니다.
1) 접속할 때 이루어지는 핸드쉐이킹 인증 구조 분석(Wire Shark)
2) 암호화된 패킷의 분석
3) 캡쳐한 패킷 내용
Frame 309 (128 bytes on wire, 128 bytes captured)
Ethernet II, Src: AsrockIn_1d:fa:85 (00:65:00:1d:00:85), Dst: Dasan_0b:2e:94 (00:00:cb:00:2e:00)
Destination: Dasan_0b:2e:94 (00:10:2b:0b:23:94)
Source: AsrockIn_1d:fa:85 (00:25:00:00:fa:00)
Type: IP (0x0800)
Internet Protocol, Src: 0.0.0.0 (0.0.0.0), Dst: 202.179.0.0 (202.179.0.0)
Transmission Control Protocol, Src Port: device2 (2030), Dst Port: 11900 (11900), Seq: 1, Ack: 1, Len: 74
Source port: device2 (2030)
Destination port: 11900 (11900)
[Stream index: 21]
Sequence number: 1 (relative sequence number)
[Next sequence number: 75 (relative sequence number)]
Acknowledgement number: 1 (relative ack number)
Header length: 20 bytes
Flags: 0x18 (PSH, ACK)
Window size: 65535
Checksum: 0x0e45 [validation disabled]
[SEQ/ACK analysis]
Data (74 bytes)
0000 55 53 45 52 30 30 36 36 38 35 36 37 31 34 64 64 USER0096856714dd
0010 34 34 34 30 62 32 33 30 32 30 62 61 31 39 66 39 4440b23020ba19f9
0020 33 61 66 63 39 38 31 30 34 63 35 36 61 63 31 65 3afc98104c56ac1e
0030 34 35 37 38 33 36 38 35 63 61 36 61 31 34 63 36 45783685ca6a14c6
0040 38 31 64 31 65 38 30 38 34 31 81d1e80841
Data: 555345523030363638353637313464643434343062323330...
[Length: 74]
No. Time Source Destination Protocol Info
310 23.157561 202.179.183.0 0.0.0.0 TCP 11900 > device2 [ACK] Seq=1 Ack=75 Win=5840 Len=0
Frame 310 (60 bytes on wire, 60 bytes captured)
Ethernet II, Src: Dasan_0b:2e:94 (00:00:cb:0b:00:00), Dst: AsrockIn_1d:fa:00 (00:00:22:00:fa:00)
Destination: AsrockIn_1d:fa:85 (00:00:00:00:00:00)
Source: Dgan_x:21:90 (00:d0:00:0b:2e:94)
Type: IP (0x0800)
Trailer: AAAA16D01CE9
Internet Protocol, Src: 0.0.0.0 (0.0.0.0), Dst:
Transmission Control Protocol, Src Port: 11900 (11900), Dst Port: device2 (2030), Seq: 1, Ack: 75, Len: 0
Source port: 11900 (11900)
Destination port: device2 (2030)
[Stream index: 21]
Sequence number: 1 (relative sequence number)
Acknowledgement number: 75 (relative ack number)
Header length: 20 bytes
Flags: 0x10 (ACK)
Window size: 5840
Checksum: 0x1ce9 [validation disabled]
[SEQ/ACK analysis]
4) 결과
* 카페 채팅에 접속하기 위한 유령 프로그램을 작성하여 인증을 받고 접속 성공
* 암호화된 송신 패킷의 복호화 및 패킷 구조 분석 완료
* 패킷 암호화 및 복호화 루틴 작성, 테스트 성공
* 모조 패킷 전송 성공
- 접속하지 않고 채팅 내용 도청과 아이디 도용, 상태 메시지 조작 가능
강퇴 권한을 갖는 것은 시간 문제겠지만..
그 이상의 시도는 위험하기 때문에 보류하겠습니다. : )
어디까지나 호기심 탐구가 목적이기 때문에 이쯤에서 마무리하겠습니다.
Written by Simhyeon, Choe
The article about what fights between Galaxy-S and iPhone 4G was very interesting. New
smart phones are announced by Samsung and Apple on the same day. Especially, iPhone
4G will be launched faster than expected in the middle of July in Korea, so Korean people
are overjoyed to hear its good news. The two products have in common that are thin and
light. The thickness of Galaxy-S is 9.9mm, but iPhone 4G is 0.6mm thinner than Galaxy-S.
Steve Jobs highligted that iPhone 4G is the thinnest smart phone on Earth. However,
Galaxy-S is 16g lighter than iPhone. Apple's softwares are already well known with high
technology in the market. In my opinion, I think that Galaxy-S will be no match for iPhone
4G yet. Samung's smart phones aren't enough contents for internet service as ever. There
is a limit as to what we can do in the Samsung's smart phone. Apple had developers
detailed training After iPhone 4G announced for three days, but Samsung was never.
Samsung never seems to consider software developer important yet. Anyway, I have
expected the fight which is between Galaxy-S and iPhone 4G. I think I should wait and see
this fight. How do you think about the fight? Have a good night~
Written by Simhyeon, Choe
I write on a blog for a long time, cuz I was busy with my job as ever.
When I surfed the net, I read articles in the blog that are written by someone.
He has written articles like me about success, but he writes better than I do.
His passion for success was amazing. I have been in the company for only
six month and already seem to fall into mannerism.
I have to see around myself who settle for the present right now.
Let's go to bed for our new day!
Written by Simhyeon, Choe
1. Win32 혹은 Win32 Console Project로 프로젝트를 생성합니다.
2. 프로젝트 탐색기의 [FileView] 탭을 선택하고 Source Files에 파일을 *.*로 선택한 후,
"파일명.ASM"으로 생성합니다.
3. 생성한 파일에서 마우스 우클릭 후, 팝업 메뉴에서 [Settings] 메뉴를 선택합니다.
4. [Setting] 메뉴에서 [Custom Bulild] 탭을 선택하고 아래와 같이
Commands와 Outputs에 빨간 박스처럼 입력합니다.
5. 입력 후, F7을 누르고 컴파일하시면 어셈블이 됩니다.
Written by Simhyeon, Choe
이것은 초급자를 위한 팁임을 미리 말씀드립니다.
1. Motivation
우리는 개발한 상위 라이브러리에서 사용하고 싶은 이벤트 혹은 메시지를
등록하고 그것을 사용자 정의 콜백 함수로 호출하는 구조를 사용자에게
제공해 주고 싶은 경우가 있습니다.
MFC와 같은 프레임워크처럼, ON_MESSAGE( UserMessage, OnUserFunction )로
사용자 정의 메시지 및 이벤트 처리하게 해주는 메커니즘을 말이죠.
2. Solution
우리가 개발한 라이브러리에서 다음과 같이 사용자 이벤트와 콜백 함수를
등록할 수 있는 함수가 있습니다.
RegisterEventHandler( ON_PMSG_CHAT, this, ClassType::OnPmsgChat );
이 구현을 위해 가장 고민해 보아야 할 문제는 여러 클래스 타입들의 메소드를
어떻게 콜백 함수로 등록할 수 있는가입니다. 다시 말해, 이것은 콜백 함수로
등록될 클래스의 타입과 클래스 메소드의 함수 포인터형을 알 수 없다는 것입니다.
MFC의 경우에는 이벤트 처리기와 메시지 맵은 CObject 이하의 수많은 클래스
타입들에 대한 오버로딩 메소드를 미리 정의하고 구현해 놓았지요.
3. Conclusion
아래 소스와 같은 구현으로 어떠한 클래스의 타입 메소드가 인수로 대입되더라도
콜백 함수로 등록하고 처리할 수 있습니다.
콜백 함수의 등록은 아래의 매크로 함수로 할 수 있습니다.
RegisterEventHandler( ON_PMSG_CHAT, this, ClassType::OnPmsgChat );
아래의 소스에서 매크로로 구현된 CMyClass::GetInstance()->AddEventHandler()는
우리가 개발한 라이브러리의 클래스 내에서 (싱글톤 패턴이라는 가정하에서는) Static
Object의 포인터를 저장하는 역할을 하는 메소드입니다.
// HandlerManager.h
#ifndef HANDLER_MANAGER_
#define HANDLER_MANAGER_
#include <iostream>
#include <windows.h>
#define RegisterEventHandler(dwMessage, pInst, lpFunc); \
static CHandlerObject &lpfn##dwMessage = SetEventProc( pInst, &lpFunc ); \
CMyClass::GetInstance()->AddEventHandler( &lpfn##dwMessage );
#define CALLBACKPROC(dwMessage, lpBuffer, dwSize); \
lpfn##dwMessage.CallBackProc( dwMessage, lpBuffer, dwSize );
class CHandlerObject
{
public:
virtual LPVOID CallBackProc(DWORD dwMessage, LPVOID lpBuffer, DWORD dwSize) = 0;
};
template <class ObjectType, typename FuncPtrType>
class CHandlerManager : public CHandlerObject
{
private:
ObjectType *m_pObject;
FuncPtrType m_pFuncPtrType;
int nCntHandler;
public:
CHandlerManager(ObjectType* pObject, FuncPtrType pFuncPtrType) : m_pObject( pObject ),
m_pFuncPtrType
( pFuncPtrType ) {}
~CHandlerManager() {}
LPVOID CallBackProc(DWORD dwMessage, LPVOID lpBuffer, DWORD dwSize)
{
(m_pObject->*m_pFuncPtrType)( dwMessage, lpBuffer, dwSize );
return NULL;
}
};
template <class ObjectType, typename FuncPtrType>
CHandlerManager<ObjectType, FuncPtrType>
SetEventProc(ObjectType *pObject, FuncPtrType pFuncPtr)
{
return CHandlerManager<ObjectType, FuncPtrType>(pObject, pFuncPtr);
}
#endif
Written By Simhyeon, Choe
다음은 어떤 데브피아 유저가 질문한 내용에 제가 답변한 글입니다.
-------------------------------------------------------------------------------------
제가 보고 있는 c 언어 책의 포인터와 문자열 부분에서 ...
char *p = "abcde";
"abcde" 는 메모리 어딘가에 문자열 리터럴로 보관되어 있다.
그런데, 메모리에 할당하기는 하지만 값을 변경할 수 없는 메모리 영역에 보관된다고 하는데 ...
어떤 영역인가요 ?
제가 메모리 영역에 대해서 잘 몰라서 질문을 드립니다.
-------------------------------------------------------------------------------------
.rdata라는 섹션에 저장됩니다. PE File View 혹은 PE File Explorer라는 툴(실행 파일 분석툴)을
사용하여 해당 파일을 열어 보시면 .rdata라는 섹션에 저장되어 있습니다. 실행 파일은 여러 개의
섹션(영역)과 그 섹션에 대한 정보를 가지는 구조로 이루어져 있습니다. 또한 각각의 섹션은 초기화,
읽기, 쓰기, 데이터, 텍스트 등의 고유한 속성에 대한 정보를 가지고 있습니다. 실행 파일이 실행될
때, 파일의 이미지가 메모리에 동일하게 맵핑됩니다. .rdata 섹션의 속성은 READ ONLY, DATA로
설정되어 있기 때문에 해당 영역에 쓰려고 할 때, 커널은 속성을 체크하고 위배되면 엑세스 위반을
일으키게 됩니다. 물론, .rdata 섹션의 속성을 쓰기로 변경하면 쓰기도 가능합니다. 이렇게 읽기
전용 데이터 섹션을 설정한 이유는 동일한 상수를 여러 곳에서 참조하기 때문이지요. 이것은 아주
당연한 이유입니다. 한곳에서 수정이 가해지면 해당 리터럴 상수를 참조하고 있는 다른 곳에서도
영향을 주기 때문입니다. Win32 운영체제는 실행 파일을 .rdata, .data, .idata, .text, .rsrc 등의
여러가지 섹션으로 코드와 데이터를 나누어 관리하고 있습니다. 이렇게 섹션을 나누어 관리하는
이유는 로더가 각 영역을 커널에서 정한 레이아웃에서 엑세스하는 데이터 및 코드를 쉽게 맵핑하고
사용하기 위함입니다. 그리고 컴파일러는 리터럴 상수를 경우에 따라 프로세스를 생성시 매번
할당하는 것이 아니라, data 섹션이 아닌 text 섹션에 직접 쓰기도 합니다. 이것은 할당 및 엑세스
속도를 빠르게 하기 위함입니다. 여기서 정확한 표현은 Segment보다는 Section으로 보는 것이
옳습니다. 그리고 위에서 님이 말씀하신 것처럼 동일한 위치를 가리키는 이유는 단순히 컴파일러
입장에서 최적화를 위한 것입니다. 동일한 상수를 .rdata 영역에 여러번 할당하는 것이 낭비고 어차피
변경 불가능하고 참조만 되어지는 대상이기 때문에 두 개의 포인터가 하나의 리터럴 상수를 가리켜도
전혀 문제될 것이 없습니다. 두번째로 질문하신 내용에 대한 답변을 드리겠습니다.
디버기 프로세스가 되지 않고 파일 접근이 아닌 이상, 해당 프로세스에서 실제 그 영역 속성의 변경은
불가능하지만, 페이지 속성 변경 및 CopyOnWrite 메커니즘으로 .rdata에 쓸 수가 있습니다.
DWORD dwReadData = 0;
char *pString = "Hello";
VirtualProtect( pString, 4096, PAGE_READWRITE, &dwReadData );
*pString = 'P';
Written By Simhyeon, Choe
I keep a diary in about a week because I was busy with my job and project for a fairly
long time. Was I tired because of those? No, I was never. All things was wonderful to
me! I think that I'm the guy that is the happiest when I learned. Come to think of it, A
native-speaking instructor teach me from today. My heart leaps up because I can learn
more about speaking English. He is three years younger than I but he looks older than
his age. : ) Nevertheless, He is a handsome guy. Perhaps I guess that he's popular
among women. Anyway, I'm interested in everything so I feel very happy.
Yeah, I'm going to bed soon. Have a good night!
Written by Simhyeon, Choe
I guess that I have ever eaten a lots of Marshmallows. That's why many things
have been regreted at heart, but I want to say let bygones be bygones. Above
all, It is now that most important thing for me. I would change mind and attitude.
My mind and attitude will determine my furture as being good. Why don't you try
reading "Don't Eat the Marshmallow"? I strongly recommend that you read the book.
I think that you can change your mind and attitude! Have a good weekend.
Thank you : )
Written by Simhyeon, Choe
이것도 한번 올려 봅니다. 밑의 콘솔 게임과 비슷한 시기에 만들었던 게임입니다.
당시, 더블 버퍼링 기법을 공부하고 적용하기 위해 게임을 만들었습니다.
역시 아주 예전에 구현하였던 터라 소스가 지저분한 것은 어쩔 수 없군요. 하하.
개발 환경 : VC++ 6.0 Win32 Project, API
조작 방법 : 스페이스(총알), 방향키(이동)
마찬가지로 실행 파일과 소스 모두 첨부합니다.
비행기 게임 소스 및 실행 파일
Written by Simhyeon, Choe
I took reserve forces training yesterday. I have never worn a military
uniform since I retired from the army, but I was difficult to wear in flesh.
I really need to go on a diet. haha. It began raining from late evening,
and therefore I took reserve forces training in a room. Actually, It wasn't
hard to do training. When I took training, I lost in the memories about my
military life. I thought that my military life was unforgettable memories
becuase I learned social lifes.
After training, I went to straight my home by bus at late night. Thank you : )
Written by Simhyeon, Choe