1. A 로 분석하고자 하는 프로그램을 로드 한 뒤 분석이 완료되길 기다린다.
2. File -> Produce file -> Create MAP File 메뉴를 이용하여 MAP 파일을 생성한다.
3. 아래 소스코드를 작성한 뒤 Immunity Debugger 에 사용한다.
import immlib
import re
import pefile
def usage(imm):
imm.log("!map [mapfile]")
imm.log(" ex) !map c:\\test.map")
def load_map(imm,filename):
map_list = []
f = open(filename, "r")
contents = f.read()
m=re.findall("\s+([\d\S]{4}):([\d\S]{8})\s+([^\d]\S+)",contents,re.M)
if len(m) > 0:
for line in m:
map_list.append([int(line[0])-1, (int(line[1],16)), line[2]])
return map_list
def main(args):
imm = immlib.Debugger()
imm.log("[*] Map v1.0 by hyunmini")
if not args:
usage(imm)
return " [-] Not found map file"
filename = args[0]
map_list = load_map(imm,filename)
module = imm.getDebuggedName()
mod = imm.getModule(module)
pe = pefile.PE(mod.getPath())
for map in map_list:
base = mod.getBaseAddress()
section = pe.sections[map[0]].VirtualAddress
func_offset = map[1]
lable = map[2]
lable_addr = base + section + func_offset
imm.setLabel(lable_addr, lable)
return "[+] Finish!! %d symbols" % len(map_list)
출처 : 윈도우 시스템 해킹 가이드 버그헌팅과 익스플로잇
'0x003 Reversing > 04. Theory' 카테고리의 다른 글
[Linux] ShellCode 제작 방법 (0) | 2017.12.29 |
---|---|
[Tip] IoT 펌웨어 분석 환경 구성 (0) | 2017.12.29 |
[Windows] Hooking Immunity Debugger (0) | 2017.12.29 |
[Tip] Process 내 DLL 주소 찾기 (0) | 2017.12.29 |