단디연구소
인텔의 IA-32구조에서 사용 되는 레지스터레지스터는 범용레지스터 8개, 명령 포인터(EIP), 세그먼트 레지스터, 플래그 레지스터 등으로 나뉜다.
시스템이 재시작 되거나 시스템이 다를경우 DLL이 메모리에 로드되는 위치가 변한다. 이러한 상황과 상관없이 API를 사용하기 위해서 커널 구조체를 이용해서 dll의 base 주소를 찾을수 있다 mov eax, fs:[eax+0x30] // PEBmov eax, [eax+0xc] // PEB_LDR_DATAmov eax, [eax+0x14] // .exe InMemoryOrderModuleListmov ebx, [eax] // ntdll.dll InMemoryOrderLinksmov ebx, [ebx] // kernel32.dll InMemoryOrderLinks mov ebx, [ebx+0x10] // ebx = kernel32.dll base address
import pefile pe = pefile.PE(file_path)machine_bit = pe.FILE_HEADER.Machine if machine_bit == 0x14c : print "x86" elif machine_bit == 0x200 : print "x64" winnt.h 머신 정보#define IMAGE_FILE_MACHINE_UNKNOWN 0#define IMAGE_FILE_MACHINE_I386 0x014c // Intel 386.#define IMAGE_FILE_MACHINE_R3000 0x0162 // MIPS little-endian, 0x160 big-endian#define IMAGE_FILE_MACHINE_R4000 0x0166 // MIPS little-endian#de..