# filename:buffer_overflow.py
# -*- coding:utf-8 -*-
from ctypes import *
msvcrt = cdll.msvcrt
raw_input("once the debugger is attached, press any key")
buf_dest = c_char_p("AAAAA")
buf_src = "A" * 100
msvcrt.strcpy(buf_dest, buf_src)
# filename:access_violation_handler.py
# -*- coding:utf-8 -*-
from pydbg import *
from pydbg.defines import *
import utils
def check_access(dbg):
if dbg.dbg.u.Exception.dwFirstChance:
return DBG_EXCEPTION_NOT_HANDLED
crash_bin = utils.crash_binning.crash_binning()
crash_bin.record_crash(dbg)
print(crash_bin.crash_synopsis())
dbg.terminate_process()
return DBG_EXCEPTION_NOT_HANDLED
pid = raw_input("enter the process id:")
dbg = pydbg()
dbg.attach(int(pid))
dbg.set_callback(EXCEPTION_ACCESS_VIOLATION, check_access)
dbg.run()