본문 바로가기

스터디/└ 소스파일들

8시간의 대장정.

from immlib import *

def main(args):
    shellcode="\x7f\xac"
    length = len(shellcode)
    shellcode=shellcode.encode("HEX")
   
    imm = Debugger()
    imm.log("Shellcode length : %s" % len(shellcode))
 #  shellcode = shellcode.encode("HEX")
    imm.log("We Finding : %s" % shellcode)
    regs = imm.getRegs()
    imm.log("EIP : 0x%08x" % regs['EIP'])
    imm.log("EBP : 0x%08x" % regs['EBP'])
    imm.log("ESP : 0x%08x" % regs['ESP'])
   
    address = regs['EBP']
    imm.log("Find start EBP")
    while 1:
        if address == regs['ESP']:
            break
       
        #check
        imm.log("address = 0x%08x" %address)
        address = address - 1
        debug_shellcode=imm.readMemory(address,length)
        debug_shellcode=debug_shellcode.encode("HEX")
        imm.log("debug_shellcode = %s" % debug_shellcode)
        if debug_shellcode == shellcode:
            imm.log("We Found it!!!")
            imm.log("Address : 0x%08x" % address)
            imm.log("SHELLCODE : %s" % shellcode)
            imm.log("DEBUG_SHELLCODE : %s" % debug_shellcode)
            return "Found."
   
    address = regs['ESP']
    imm.log("Find start ESP")
    while 1:
        if address == regs['EBP']:
            break
       
        #cross check
        imm.log("address = 0x%08x" %address)
        address = address + 1
        debug_shellcode=imm.readMemory(address,length)
        debug_shellcode=debug_shellcode.encode("HEX")
        imm.log("debug_shellcode = %s" % debug_shellcode)
        if debug_shellcode == shellcode:
            imm.log("We Found it!!!")
            imm.log("Address : 0x%08x" % address)
            imm.log("SHELLCODE : %s" % shellcode)
            imm.log("DEBUG_SHELLCODE : %s" % debug_shellcode)
            return "Found"
   
   
       
    return "Done."

# 파이썬 해킹 프로그래밍 문자열 필터링링

'스터디 > └ 소스파일들' 카테고리의 다른 글

firfox_hook.py  (0) 2015.01.26
hippie_easy.py  (0) 2015.01.26
책 원본 소스파일  (0) 2015.01.20
Memory Breakpoint 까지의 소스  (0) 2015.01.17
Hardware Breakpoint 까지 소스  (0) 2015.01.17