print CrashDump.dump_code(code, eip) n = 10000 #kernel32!start+0xd52c6 # Access first parameter on the stack: EBP + 4 stack_offset = thread.get_sp() + 4 # Write the new value at that address (e.g. 0 milliseconds) process.write_dword(stack_offset, n) global f, file file = "c:\\python\\hook\\1.cfg" print file f = open(file) #h = Hack(processName="notepad.exe") h = Hack(pid=sys.argv[1]) #h.add_hook('kernel32', "CreateFileW", pre_createfilew) #h.add_hook('kernel32', 'WriteProcessMemory', pre_writeprocessmemory) #h.add_hook('kernel32', 'CreateRemoteThread', pre_CreateRemoteThread) #h.add_hook('kernel32', 'CreateProcessInternalW', pre_createprocess); h.add_hook('kernel32', 'Sleep', pre_Sleep) #h.add_hook('wininet', 'InternetConnectW', pre_InternetConnectW); #h.add_hook("wininet", "HttpOpenRequest", pre_HttpOpenRequest) h.hook() f.close() h.safe_exit()
print print "usage : %s pid [act]" % sys.argv[0] sys.exit(-1) h = Hack(pid=pid) if not act is None and os.path.exists(act): fp = open(act, "r") hook_list = [] for line in fp.readlines(): print line dll, func, callback = _split_dll_func(line, 2) if not dll is None or not func is None or not callback is None: print "1" h.add_hook(dll, func, callback) else: print "2" hook_list = [o for o in getmembers(dll) if isfunction(o[1])] print hook_list else: if not act is None: dll, func, callback = _split_dll_func(act, 2) if not dll is None or not func is None or not callback is None: print dll, " : ", func, " : ", callback h.add_hook(dll, func, callback) #h.add_hook("ws2_32.dll", "sendto", sendto)