hook IE 的send recv函数
我现在要hook ie的send和recv函数,想把网页的内容拿下来,dll已经写好了,还写了个将它注入IE的程序,通过IceWorld查看也证明这个Dll也成功的注入IE了,但是我自己的MySend函数不起作用,不知道是为什么。希望有经验的大神们帮忙看看吧。谢啦!
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"
#include <WinSock.h>
#include <stdio.h>
#include "detours.h"
#pragma comment(lib, "ws2_32.lib")
#pragma comment (lib,"detours.lib")
#pragma comment (lib,"detoured.lib")
int (WINAPI *pSend)(SOCKET s, const char* buf,int len, int flags) = send;
int WINAPI MySend(SOCKET s, const char* buf,int len, int flags);
int (WINAPI *pRecv)(SOCKET s, __out_bcount_part(len, return) __out_data_source(NETWORK) char* buf,int len, int flags) = recv;
int WINAPI MyRecv(SOCKET s, __out_bcount_part(len, return) __out_data_source(NETWORK) char* buf,int len, int flag);
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
FILE *pSendLogFile;
fopen_s(&pSendLogFile, "C: \\SendLog.txt", "a+");
fprintf(pSendLogFile, "%s\n", buf);
MessageBox(NULL,"Error!send","Error in Detours!",MB_OK);
fclose(pSendLogFile);
return pSend(s, buf, len, flags);
}
int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags)
{
FILE *pRecvLogFile;
fopen_s(&pRecvLogFile, "C: \\RecvLog.txt", "a+");
fprintf(pRecvLogFile, "%s\n", buf);
MessageBox(NULL,"Error!recv","Error in Detours!",MB_OK);
fclose(pRecvLogFile);
return pRecv(s, buf, len, flags);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
int error;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
DetourTransactionBegin();
DetourUpdateThread(::GetCurrentThread());
DetourAttach(&(PVOID&)pSend, MySend);
error = DetourTransactionCommit();
if(NO_ERROR!=error)
{
MessageBox(NULL,"Error!","Error in Detours!",MB_OK);
}
DetourTransactionBegin();
DetourUpdateThread(::GetCurrentThread());
DetourAttach(&(PVOID&)pRecv, MyRecv);
error = DetourTransactionCommit();
if(NO_ERROR!=error)
{
MessageBox(NULL,"Error!","Error in Detours!",MB_OK);
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)pSend, MySend);
error = DetourTransactionCommit();
MessageBox(NULL,"Detour ends","Prompt!",MB_OK);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)pRecv, MyRecv);
error = DetourTransactionCommit();
MessageBox(NULL,"Detour ends","Prompt!",MB_OK);
break;
; }
return TRUE;
}
相关推荐
hook send recv wsasend wsarecv 封包工具源码
hook send recv wsasend wsarecv 封包工具源码 本工具支持命令行操作,采用远程线程注入目标进程,注入后hook发包函数,实现封包拦截。 主程序为MFC编写 动态链接库VC WIN32项目
全局HOOK的例子,HOOK了IE用到的send
通过DLL注入来HOOK IE用到的send函数 所有IE通过send函数发出去的数据都会被记录下来
hook 浏览器控件收发包
1. hook mfc浏览器控件收发包
技术转移机构如何基于数据提升项目撮合精准度?.docx
技术转移机构如何基于数据提升项目撮合精准度?
超扭滑模与快速终端滑模的永磁同步电机无感控制:理论、离散化实现与仿真研究(Simulink仿真实现)
内容概要:本文系统研究了超扭滑模控制(STSMC)与快速终端滑模控制(FTSMC)在永磁同步电机(PMSM)无感控制中的应用,重点涵盖其理论基础、离散化实现方法及Simulink仿真验证。文章深入阐述了两种高阶滑模控制策略的设计原理,利用磁链无感观测技术实现转子位置与速度的精确估计,从而省去物理传感器,有效提升了系统的可靠性与鲁棒性。同时,提供了完整的Simulink仿真模型构建方案,包括控制器设计、关键参数整定及动态响应性能分析,充分验证了所提出的方法在零速与低速工况下的卓越控制性能和有效性。; 适合人群:具备电机控制、现代控制理论基础知识及熟练掌握MATLAB/Simulink仿真技能的研究生、科研人员与工程技术人员。; 使用场景及目标:①深入理解高阶滑模控制在电机驱动系统中的设计思想与具体实现;②掌握基于滑模观测器的无感控制核心技术;③开展永磁同步电机高性能控制算法的理论研究、仿真验证与工程化探索。; 阅读建议:建议将文中详尽的理论推导与Simulink仿真模型相结合进行学习,重点关注滑模面的构建、抖振抑制策略的实施以及离散化处理的细节,有条件的研究者可进一步将算法移植到DSP等硬件平台进行实验验证,以深化对理论的理解并检验其实际应用效果。


进程/线程/DLL
