青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

道。道。道

安全特性不等于安全的特性

   :: 首頁 :: 聯系 :: 聚合  :: 管理

常用鏈接

搜索

  •  

最新評論

??1?//////////////////////////////////////////////////////////////////////?
??2?附錄:一個攔截CreateFile函數的簡單實現?
??3?//////////////////////////////////////////////////////////////////////?
??4?#include?<stdio.h>?
??5?#include?<windows.h>?
??6?#include?<Psapi.h>?
??7?
??8?#pragma?comment(lib,?"psapi.lib")?
??9?
?10?typedef?struct?_RemoteParam?{?
?11???DWORD?dwCreateFile;?
?12???DWORD?dwMessageBox;?
?13???DWORD?dwGetCurrentProcess;?
?14???DWORD?dwWriteProcessMemory;?
?15???unsigned?char?szOldCode[10];?
?16???DWORD?FunAddr;?
?17?}?RemoteParam,?*?PRemoteParam;?
?18?
?19?typedef?HANDLE?(__stdcall?*?PFN_CREATEFILE)(LPCTSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);?
?20?typedef?int?(__stdcall?*?PFN_MESSAGEBOX)(HWND,?LPCTSTR,?LPCTSTR,?DWORD);?
?21?typedef?BOOL?(__stdcall?*?PFN_WRITEPROCESSMEMORY)(HANDLE,LPVOID,LPCVOID,SIZE_T,SIZE_T*);?
?22?typedef?HANDLE?(__stdcall?*?PFN_GETCURRENTPROCESS)(void);?
?23?
?24?#define?PROCESSNUM?128?
?25?#define?MYMESSAGEBOX?"MessageBoxW"?
?26?#define?MYCREATEFILE?"CreateFileW"?
?27?
?28?void?HookCreateFile(LPVOID?lParam)?
?29?{?
?30?
?31???RemoteParam*?pRP?=?(RemoteParam*)lParam;?
?32?
?33?
?34???DWORD?NextIpAddr?=?0;?
?35???DWORD?dwParamaAddr?=?0;?
?36?
?37???HANDLE?RetFpHdl?=?INVALID_HANDLE_value;?
?38???LPCTSTR?lpFileName;?
?39???DWORD?dwDesiredAccess;?
?40???DWORD?dwShareMode;?
?41???LPSECURITY_ATTRIBUTES?lpSecurityAttributes;?
?42???DWORD?dwCreationDisposition;?
?43???DWORD?dwFlagsAndAttributes;?
?44???HANDLE?hTemplateFile;?
?45???PFN_CREATEFILE?pfnCreatefile?=?(PFN_CREATEFILE)pRP->dwCreateFile;?
?46?
?47?
?48???__asm?
?49???{?
?50?????MOV?EAX,[EBP+8]?
?51?????MOV?[dwParamaAddr],?EAX?
?52?????MOV?EAX,[EBP+12]???????????
?53?????MOV?[NextIpAddr],?EAX?
?54?????MOV?EAX,[EBP+16]?
?55?????MOV?[lpFileName],?EAX?
?56?????MOV?EAX,[EBP+20]?
?57?????MOV?[dwDesiredAccess],EAX?
?58?????MOV?EAX,[EBP+24]?
?59?????MOV?[dwShareMode],EAX?
?60?????MOV?EAX,[EBP+28]?
?61?????MOV?[lpSecurityAttributes],EAX?
?62?????MOV?EAX,[EBP+32]?
?63?????MOV?[dwCreationDisposition],EAX?
?64?????MOV?EAX,[EBP+36]?
?65?????MOV?[dwFlagsAndAttributes],EAX?
?66?????MOV?EAX,[EBP+40]?
?67?????MOV?[hTemplateFile],EAX?????
?68???}?
?69?
?70???PFN_MESSAGEBOX?pfnMessageBox?=?(PFN_MESSAGEBOX)pRP->dwMessageBox;?
?71???int?allowFlag?=?pfnMessageBox(NULL,?lpFileName,?NULL,?MB_ICONINformATION?|?MB_YESNO);?
?72????
?73???if(allowFlag?==?IDYES)?
?74???{?
?75???unsigned?char?szNewCode[10];?
?76???int?PramaAddr?=?(int)dwParamaAddr;?
?77???szNewCode[4]?=?PramaAddr>>24;?
?78???szNewCode[3]?=?(PramaAddr<<8)>>24;?
?79???szNewCode[2]?=?(PramaAddr<<16)>>24;?
?80???szNewCode[1]?=?(PramaAddr<<24)>>24;?
?81???szNewCode[0]?=?0x68;?
?82????
?83???int?funaddr?=?(int)pRP->FunAddr?-?(int)pfnCreatefile?-?10?;?
?84???szNewCode[9]?=?funaddr>>24;?
?85???szNewCode[8]?=?(funaddr<<8)>>24;?
?86???szNewCode[7]?=?(funaddr<<16)>>24;?
?87???szNewCode[6]?=?(funaddr<<24)>>24;?
?88???szNewCode[5]?=?0xE8;?
?89????
?90????
?91???PFN_GETCURRENTPROCESS?pfnGetCurrentProcess?=?(PFN_GETCURRENTPROCESS)pRP->dwGetCurrentProcess;?
?92???PFN_WRITEPROCESSMEMORY?pfnWriteProcessMemory?=?(PFN_WRITEPROCESSMEMORY)pRP->dwWriteProcessMemory;?
?93???pfnWriteProcessMemory(pfnGetCurrentProcess(),?
?94?????????????????????????(LPVOID)pfnCreatefile,?
?95?????????????????????????(LPCVOID)pRP->szOldCode,?
?96?????????????????????????10,?
?97?????????????????????????NULL);?
?98?
?99???RetFpHdl?=?pfnCreatefile(lpFileName,?
100?????????????????????????????dwDesiredAccess,?
101?????????????????????????????dwShareMode,?
102?????????????????????????????lpSecurityAttributes,?
103?????????????????????????????dwCreationDisposition,?
104?????????????????????????????dwFlagsAndAttributes,?
105?????????????????????????????hTemplateFile);?
106???pfnWriteProcessMemory(pfnGetCurrentProcess(),?
107?????????????????????????(LPVOID)pfnCreatefile,?
108?????????????????????????(LPCVOID)szNewCode,?
109?????????????????????????10,?
110?????????????????????????NULL);?
111???}?
112?
113?
114???__asm?
115???????{POP?EDI?
116?????????POP?ESI?
117?????????POP?EBX?
118?????????MOV?EDX,?[NextIpAddr]?
119?????????MOV?EAX,?[RetFpHdl]?
120?????????MOV?ESP,?EBP?
121?????????POP?EBP?
122?????????ADD?ESP,?28H???
123?????????PUSH?EDX?
124?????????RET?
125???????}?
126?
127????
128?}?
129?
130?
131?
132?BOOL?AdjustProcessPrivileges(LPCSTR?szPrivilegesName)?
133?{?
134???HANDLE?hToken;?
135???TOKEN_PRIVILEGES?tkp;?
136?
137???if(!OpenProcessToken(GetCurrentProcess(),?
138???????TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken))?
139???{?
140???????return?FALSE;?
141???}?
142?
143???if(!LookupPrivilegeValue(NULL,szPrivilegesName,?
144?????????????????????????????&tkp.Privileges[0].Luid))?
145???{?
146???????CloseHandle(hToken);?
147???????return?FALSE;?
148???}?
149????
150???tkp.PrivilegeCount?=?1;?
151???tkp.Privileges[0].Attributes?=?SE_PRIVILEGE_ENABLED;?
152????
153???if(!AdjustTokenPrivileges(hToken,FALSE,&tkp,sizeof(tkp),NULL,NULL))?
154???{?
155???????CloseHandle(hToken);?
156???????return?FALSE;?
157???}?
158????
159???CloseHandle(hToken);?
160???return?TRUE;?
161?}?
162?
163?
164?void?printProcessNameByPid(?DWORD?ProcessId?)?
165?{?
166???HANDLE?pHd;?
167???HMODULE?pHmod;?
168???char?ProcessName[MAX_PATH]?=?"unknown";?
169???DWORD?cbNeeded;?
170???pHd?=?OpenProcess(?PROCESS_QUERY_INformATION?|PROCESS_VM_READ,?FALSE,?ProcessId?);?
171???if(pHd?==?NULL)?
172???????return;?
173????
174???if(!EnumProcessModules(?pHd,?&pHmod,?sizeof(pHmod),?&cbNeeded))?
175???????return;?
176???if(!GetModuleFileNameEx(?pHd,?pHmod,?ProcessName,?MAX_PATH))?
177???????return;?
178????
179???printf(?"%dt%sn",?ProcessId,?ProcessName);?
180???CloseHandle(?pHd?);?
181???return;?
182?}?
183?
184?
185?int?main(void)?
186?{?
187?
188?????if(!AdjustProcessPrivileges(SE_DEBUG_NAME))?
189?????{?
190?????????printf("AdjustProcessPrivileges?Error!n");?
191?????????return?-1;?
192?????}?
193?
194?????DWORD?Pids[PROCESSNUM];?
195?????DWORD?dwProcessNum?=?0;?
196?????if(!EnumProcesses(Pids,?sizeof(Pids),?&dwProcessNum))?
197?????{?
198?????????printf("EnumProcess?Error!n");?
199?????????return?-1;?
200?????}?
201??????
202?????for(?DWORD?num?=?0;?num?<?(dwProcessNum?/?sizeof(DWORD));?num++)?
203?????????printProcessNameByPid(Pids[num]);?
204?
205?????printf("nAll?%d?processes?running.?n",?dwProcessNum?/?sizeof(DWORD));?
206?
207?????DWORD?dwPid?=?0;?
208?????printf("n請輸入要攔截的進程id:");?
209?????scanf("%d",?&dwPid);?
210??????
211?????HANDLE?hTargetProcess?=?OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ,?FALSE,?dwPid);?
212?????if(hTargetProcess?==?NULL)?
213?????{?
214?????????printf("OpenProcess?Error!n");?
215?????????return?-1;?
216?????}?
217?
218?????DWORD?dwFunAddr?=?(DWORD)VirtualAllocEx(hTargetProcess,?NULL,?8192,?
219?????????????????????????????????????????????MEM_COMMIT?|?MEM_RESERVE,?PAGE_EXECUTE_READWRITE);?
220??????
221?????if((LPVOID)dwFunAddr?==?NULL)?
222?????{?
223?????????printf("申請線程內存失敗!n");?
224?????????CloseHandle(hTargetProcess);?
225?????????return?-1;?
226?????}?
227?
228?????DWORD?dwPramaAddr?=?(DWORD)VirtualAllocEx(hTargetProcess,?NULL,?sizeof(RemoteParam),?
229???????????????????????????????????????????????MEM_COMMIT?|?MEM_RESERVE,?PAGE_EXECUTE_READWRITE);?
230?
231?????if((LPVOID)dwPramaAddr?==?NULL)?
232?????{?
233?????????printf("申請參數內存失敗!n");?
234?????????CloseHandle(hTargetProcess);?
235?????????return?-1;?
236?????}?
237?
238?????printf("n線程內存地址:%.8xn"?
239???????????"參數內存地址:%.8xn",?
240???????????dwFunAddr,?dwPramaAddr);?
241???????RemoteParam?RParam;?
242?????ZeroMemory(&RParam,?sizeof(RParam));?
243?????HMODULE?hKernel32?=?LoadLibrary("kernel32.dll");?
244?????HMODULE?hUser32?=?LoadLibrary("user32.dll");?
245?
246?????RParam.dwCreateFile?=?(DWORD)GetProcAddress(hKernel32,?MYCREATEFILE);?
247?????RParam.dwGetCurrentProcess?=?(DWORD)GetProcAddress(hKernel32,?"GetCurrentProcess");?
248?????RParam.dwWriteProcessMemory?=?(DWORD)GetProcAddress(hKernel32,?"WriteProcessMemory");?
249?????RParam.dwMessageBox?=?(DWORD)GetProcAddress(hUser32,?MYMESSAGEBOX);?
250??????
251?????unsigned?char?oldcode[10];?
252?????unsigned?char?newcode[10];?
253?????int?praadd?=?(int)dwPramaAddr;?
254?????int?threadadd?=?(int)dwFunAddr;?
255?????newcode[4]?=?praadd>>24;?
256?????newcode[3]?=?(praadd<<8)>>24;?
257?????newcode[2]?=?(praadd<<16)>>24;?
258?????newcode[1]?=?(praadd<<24)>>24;?
259?????newcode[0]?=?0x68;?
260????
261?????int?offsetaddr?=?threadadd?-?(int)RParam.dwCreateFile?-?10?;?
262?????newcode[9]?=?offsetaddr>>24;?
263?????newcode[8]?=?(offsetaddr<<8)>>24;?
264?????newcode[7]?=?(offsetaddr<<16)>>24;?
265?????newcode[6]?=?(offsetaddr<<24)>>24;?
266?????newcode[5]?=?0xE8;?
267?
268?????printf("NewCode:");?
269?????for(int?j?=?0;?j?<?10;?j++)?
270?????????printf("0x%.2x?",newcode[j]);?
271?????printf("nn");?
272?
273?
274?
275?????if(!ReadProcessMemory(GetCurrentProcess(),?
276???????????????????????????(LPCVOID)RParam.dwCreateFile,?
277???????????????????????????oldcode,?
278???????????????????????????10,?
279???????????????????????????&dwPid))?
280?????{?
281?????????printf("read?error");?
282?????????CloseHandle(hTargetProcess);?
283?????????FreeLibrary(hKernel32);?
284?????????return?-1;?
285?????}?
286?
287?????strcat((char*)RParam.szOldCode,?(char*)oldcode);?
288?????RParam.FunAddr?=?dwFunAddr;?
289?
290?????printf(?
291???????????"RParam.dwCreate文件:%.8xn"?
292???????????"RParam.dwMessageBox:%.8xn"?
293???????????"RParam.dwGetCurrentProcess:%.8xn"?
294???????????"RParam.dwWriteProcessMemory:%.8xn"?
295???????????"RParam.FunAddr:%.8xn",?
296???????????RParam.dwCreateFile,?
297???????????RParam.dwMessageBox,?
298???????????RParam.dwGetCurrentProcess,?
299???????????RParam.dwWriteProcessMemory,?
300???????????RParam.FunAddr);?
301?????printf("RParam.szOldCode:");?
302?????for(?int?i?=?0;?i<?10;?i++)?
303?????????printf("0x%.2x?",?RParam.szOldCode);?
304?????printf("n");?
305??????
306??????
307?????if(!WriteProcessMemory(hTargetProcess,?(LPVOID)dwFunAddr,?(LPVOID)&HookCreateFile,?8192,?&dwPid))?
308?????{?
309?????????printf("WriteRemoteProcessesMemory?Error!n");?
310?????????CloseHandle(hTargetProcess);?
311?????????FreeLibrary(hKernel32);?
312?????????return?-1;?
313?????}?
314?
315?????if(!WriteProcessMemory(hTargetProcess,?(LPVOID)dwPramaAddr,?(LPVOID)&RParam,?sizeof(RemoteParam),?&dwPid))?
316?????{?
317?????????printf("WriteRemoteProcessesMemory?Error!n");?
318?????????CloseHandle(hTargetProcess);?
319?????????FreeLibrary(hKernel32);?
320?????????return?-1;?
321?????}?
322??????
323?????if(!WriteProcessMemory(hTargetProcess,?(LPVOID)RParam.dwCreateFile,?(LPVOID)newcode,?10,?&dwPid))?
324?????{?
325?????????printf("WriteRemoteProcessesMemory?Error!n");?
326?????????CloseHandle(hTargetProcess);?
327?????????FreeLibrary(hKernel32);?
328?????????return?-1;?
329?????}?
330?
331?????printf("nThat's?all,?good?luck?:)n");?
332?????CloseHandle(hTargetProcess);?
333?????FreeLibrary(hKernel32);?
334?????return?0;?
335?}?
posted on 2006-11-18 16:52 獨孤九劍 閱讀(386) 評論(0)  編輯 收藏 引用 所屬分類: Win32 、Visual C++ 8.0
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国语自产精品视频在线看8查询8| 欧美在线视频网站| 欧美一级在线视频| 亚洲视频中文| 欧美福利专区| 欧美二区在线观看| 伊人成人在线视频| 亚洲欧美日本日韩| 亚洲一区亚洲| 欧美午夜不卡视频| 亚洲精品乱码久久久久久黑人| 在线高清一区| 久久精彩免费视频| 久久久蜜桃一区二区人| 国产日韩欧美一区二区三区四区| 一区二区三区欧美亚洲| 中日韩午夜理伦电影免费| 欧美精品一区二区三区四区| 欧美国产一区视频在线观看| 亚洲电影免费| 免费亚洲视频| 亚洲日本欧美天堂| 一区二区激情| 国产精品久久午夜夜伦鲁鲁| 亚洲一区二区免费在线| 欧美在线免费视频| 国产午夜精品一区二区三区视频| 性久久久久久久久| 久久女同互慰一区二区三区| 激情自拍一区| 欧美成年人视频网站欧美| 亚洲大胆人体在线| 亚洲乱码国产乱码精品精天堂| 欧美美女喷水视频| 一道本一区二区| 亚洲欧美日韩国产中文| 国产欧美日韩视频一区二区三区| 久久国产色av| 欧美激情在线免费观看| 亚洲视频在线一区| 国产日韩亚洲欧美综合| 久久久久成人网| 亚洲激情在线激情| 亚洲欧美99| 在线看欧美视频| 欧美绝品在线观看成人午夜影视 | 噜噜爱69成人精品| 亚洲国产电影| 国产精品久久久久久久久动漫| 午夜精品久久久久久久99黑人| 女生裸体视频一区二区三区| 在线午夜精品自拍| 国内外成人免费激情在线视频 | 久久久久一本一区二区青青蜜月| 欧美激情1区2区3区| 亚洲一区二区三区激情| 好吊色欧美一区二区三区视频| 欧美精品一区二区三区一线天视频| 亚洲午夜在线观看| 欧美成人激情视频免费观看| 亚洲图片你懂的| 激情欧美丁香| 欧美性事在线| 免费看亚洲片| 亚洲欧洲99久久| 亚洲人体1000| 理论片一区二区在线| 亚洲视频999| 亚洲第一精品在线| 国产精品日本精品| 欧美大尺度在线观看| 欧美一区成人| 亚洲婷婷综合色高清在线 | 欧美在线视频在线播放完整版免费观看| 欧美大片在线观看| 欧美一区深夜视频| 亚洲天堂免费在线观看视频| 亚洲国产精品久久久久婷婷老年| 国产精品最新自拍| 欧美日韩国产区一| 欧美激情在线免费观看| 久久久久久久网| 午夜免费日韩视频| 99re这里只有精品6| 欧美激情一二三区| 久久影视三级福利片| 久久精品91久久香蕉加勒比| 亚洲综合视频在线| 一本色道久久综合亚洲精品不卡| 亚洲大胆人体在线| 精品成人在线视频| 国产视频观看一区| 国产目拍亚洲精品99久久精品| 欧美日韩国产综合视频在线观看 | 国产人成精品一区二区三| 欧美日韩你懂的| 欧美人交a欧美精品| 免费在线看一区| 麻豆成人综合网| 老鸭窝91久久精品色噜噜导演| 久久精品国产77777蜜臀| 亚洲欧美日本国产专区一区| 亚洲尤物精选| 午夜欧美不卡精品aaaaa| 亚洲午夜未删减在线观看| 99在线热播精品免费| 日韩一区二区精品| 夜夜嗨av色综合久久久综合网| 亚洲乱码视频| 一本不卡影院| 亚洲调教视频在线观看| 亚洲伊人伊色伊影伊综合网| 亚洲在线国产日韩欧美| 亚洲尤物在线视频观看| 午夜精品久久久久久久99黑人| 亚洲欧美日韩国产中文在线| 亚洲男同1069视频| 性8sex亚洲区入口| 久久久91精品国产一区二区精品| 久久精品亚洲一区| 免费日韩精品中文字幕视频在线| 欧美va亚洲va国产综合| 欧美精品成人一区二区在线观看| 欧美国产精品人人做人人爱| 欧美日韩99| 国产精品亚发布| 国产亚洲精品久久久| 影音先锋久久| 99视频超级精品| 午夜国产精品影院在线观看| 久久er精品视频| 欧美成人精品h版在线观看| 91久久综合亚洲鲁鲁五月天| av不卡在线观看| 久久国产福利国产秒拍| 欧美va天堂在线| 国产精品久久久久久久久久久久久 | 国产精品久久二区| 精品成人久久| 99re6这里只有精品视频在线观看| 亚洲深夜福利| 久久久之久亚州精品露出| 亚洲国产欧美日韩| 午夜精品理论片| 欧美国产免费| 国产日韩一区二区| 日韩一级精品视频在线观看| 亚洲欧美国产精品va在线观看| 蜜桃av一区二区在线观看| 亚洲美女免费视频| 久久精品国产99国产精品澳门| 欧美韩日一区二区| 国产午夜精品麻豆| 一区二区三区蜜桃网| 裸体丰满少妇做受久久99精品| 亚洲精品日韩欧美| 久久久精品国产一区二区三区 | 欧美日韩中文| 精品成人国产| 欧美一区视频在线| 亚洲美女av网站| 久久免费国产| 国产午夜精品全部视频播放| 夜夜嗨av一区二区三区中文字幕 | 国产精品99久久久久久白浆小说| 久久久精品动漫| 国产精品亚洲综合一区在线观看| 亚洲欧洲一区二区三区在线观看| 久久精品成人一区二区三区| aa成人免费视频| 欧美国产精品v| 亚洲福利视频二区| 久久午夜影视| 欧美一区二区三区免费观看| 欧美网站在线| 一区二区三区精品在线| 亚洲精品1区| 欧美成人精精品一区二区频| 激情欧美一区二区三区在线观看 | 欧美二区乱c少妇| 久久成人精品无人区| 国产精品夜夜嗨| 亚洲综合欧美日韩| 99日韩精品| 国产精品福利网站| 在线视频中文亚洲| 亚洲精品一品区二品区三品区| 免费日韩av| 日韩视频免费观看| 亚洲人成人一区二区三区| 美女主播一区| 亚洲精品免费在线| 亚洲黄色毛片| 欧美日韩麻豆| 亚洲一区二区三区四区五区黄| 9国产精品视频| 国产精品嫩草影院一区二区| 亚洲欧美日韩天堂| 亚洲欧美国产另类| 黑人巨大精品欧美黑白配亚洲|