|
本帖最后由 htpidk 于 2021-10-17 10:16 编辑
代码好简单,如果再加上HOOK wininet winhttp的API就可以实现获取所有方式访问网页的地址
#include "detours.h"
#include <Windows.h>
#pragma comment(lib,"detours.lib")
#import "C:\\Windows\\SysWOW64\\winhttpcom.dll" no_namespace
DWORD* OldOpen=0;
HRESULT __stdcall NewOpen(IWinHttpRequest* ecxthis,BSTR method,BSTR url,VARIANT Async = vtMissing){
MessageBox(NULL,url,L"提示",MB_OK);
return ((HRESULT (__stdcall*)(IWinHttpRequest*,BSTR,BSTR,VARIANT))OldOpen)(ecxthis,method,url,Async);
}
void WinHttpComHook_OpenFunction(){
IWinHttpRequest* piwhr=NULL;
CoInitialize(NULL);
CoCreateInstance(__uuidof(WinHttpRequest),NULL,CLSCTX_ALL,__uuidof(IWinHttpRequest),(LPVOID*)&piwhr);
DWORD* vptr=(DWORD*)*(DWORD*)piwhr;
OldOpen=(DWORD*)*(vptr+9);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach((PVOID*)&OldOpen,(PVOID)NewOpen);
DetourTransactionCommit();
CoUninitialize();
}
|
评分
-
参与人数 1 | 好评 +1 |
收起
理由
|
yeweiyang
| + 1 |
DWORD* vptr=(DWORD*)*(DWORD*)piwhr; 这一句有问题啊,本来就DWORD*类型的变量,为什. |
查看全部评分
|