;****************************************************;线程函数;****************************************************_debugThread_proc proc uses esi edi ebx lpParam LOCAL @nReaderNumber LOCAL @result[20] invoke RtlZeroMemory,addr @nReaderNumber,sizeof @nReaderNumber invoke GetStartupInfo,offset stStartUp invoke CreateProcess,offset szFilePath,NULL,NULL,NULL,NULL,DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS,NULL,\ NULL,offset stStartUp,offset stPF ;创建进程 ;nvoke _showerror_proc,250h .while TRUE invoke WaitForDebugEvent,offset stDebugEvent,INFINITE mov stContext.ContextFlags,CONTEXT_FULL ;设置获得所有寄存器 invoke GetThreadContext,stPF.hThread,offset stContext;获得线程的上下文 or stContext.regFlag,0100h;对TF位置为操作 invoke SetThreadContext,stPF.hThread,offset stContext ;设置线程的上下文 .break .if stDebugEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT .if stDebugEvent.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT invoke ReadProcessMemory,stPF.hProcess,lpEntryPointer,offset Oldcommand,1,addr @nReaderNumber invoke WriteProcessMemory,stPF.hProcess,lpEntryPointer,offset dbINT3,1,addr @nReaderNumber invoke _setTextToPeInfoDialog,addr stContext ;将CONTEXT中的数据显示到dialog上 .elseif stDebugEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT invoke _setTextToPeInfoDialog,addr stContext .endif invoke WaitForSingleObject,hEvent,INFINITE;将此进程挂起 invoke ContinueDebugEvent,stPF.dwProcessId,stPF.dwThreadId,DBG_CONTINUE .endw invoke MessageBox,NULL,offset szExitDebug,offset szExitDebug,MB_OK invoke ExitThread,12 ret _debugThread_proc endp
[课程]Android-CTF解题方法汇总!