利用进程空闲为壳软件打补丁3例
一、利用Sleep延迟进程启动
.586
.model flat, stdcall
option casemap :none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include kernel32.inc
include user32.inc
include macros.inc
includelib kernel32.lib
includelib user32.lib
.data
FileName db crackme.exe,0
NewBytes db 74h ;写入的新字节
OldBytes db 75h ;原来的字节
.data?
startinfo STARTUPINFO <>
pi PROCESS_INFORMATION <>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
start:
invoke GetStartupInfo,addr startinfo
invoke CreateProcess,addr FileName,NULL,NULL,NULL,FALSE,CREATE_NEW_PROCESS_GROUP,NULL,NULL,addr startinfo,addr pi
.if eax == 0
invoke MessageBox,NULL,CTXT("请置于程序目录"),CTXT("错误!"),MB_OK
.endif
invoke Sleep,500 ;延迟 500 毫秒等待壳的解压
invoke SuspendThread,pi.hProcess ;然后迅速挂起
invoke WriteProcessMemory,pi.hProcess,004010F9h,addr NewBytes,sizeof NewBytes,addr OldBytes ;写入字节
invoke ResumeThread,pi.hProcess ;恢复线程
end start
二、利用WaitForInputIdle等待系统空闲
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke CreateProcess,addr FileName ,NULL,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL, addr startinfo,addr pi
cmp eax,0
jz eror_1
invoke WaitForInputIdle,pi.hProcess,INFINITE ;等候进程进入空闲状态
invoke WriteProcessMemory,pi.hProcess,004010F9h,CTXT(74h),1,NULL
cmp eax,0
jz eror_2
fin:
invoke <
补充:综合编程 , 安全编程 ,