- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我设法编写了一个 Hook recv 函数的半工作 EasyHook 示例。我编写了一个表单,添加了一个 WebBrowser 组件,然后启动了应用程序。问题是,我得到了 HTTP 数据包,但如果有套接字,似乎 recv 停止“ Hook ”。问题是,使用外部应用程序 Spystudio,我可以让它们挂接 recv。那么,我错过了什么?
using System;
using System.Collections.Generic;
using System.Data;
using System.Runtime.InteropServices;
using System.Threading;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Ipc;
using EasyHook;
namespace flashing
{
public partial class Form1 : Form,EasyHook.IEntryPoint
{
public LocalHook CreateRecvHook;
public Form1()
{
InitializeComponent();
}
[DllImport("Ws2_32.dll")]
static extern int recv(
IntPtr socketHandle,
IntPtr buf,
int count,
int socketFlags
);
[UnmanagedFunctionPointer(CallingConvention.StdCall,
CharSet = CharSet.Unicode,
SetLastError = true)]
delegate int Drecv(
IntPtr socketHandle,
IntPtr buf,
int count,
int socketFlags
);
static int recv_Hooked(
IntPtr socketHandle,
IntPtr buf,
int count,
int socketFlags)
{
int bytesCount = recv(socketHandle, buf, count, socketFlags);
if (bytesCount > 0)
{
byte[] newBuffer = new byte[bytesCount];
Marshal.Copy(buf, newBuffer, 0, bytesCount);
string s = System.Text.ASCIIEncoding.ASCII.GetString(newBuffer);
TextWriter tw = new StreamWriter("log.txt");
tw.Write(s);
tw.Close();
Debug.WriteLine("Hooked:>" + s);
}
return bytesCount;
}
private void bottonHook_Click(object sender, EventArgs e)
{
try
{
CreateRecvHook = LocalHook.Create(
LocalHook.GetProcAddress("Ws2_32.dll", "recv"),
new Drecv(recv_Hooked),
this);
CreateRecvHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}
catch (Exception ExtInfo)
{
Debug.WriteLine("Error creating the Hook");
return;
}
RemoteHooking.WakeUpProcess();
}
private void buttonLoader_Click(object sender, EventArgs e)
{
axShockwaveFlash1.LoadMovie(0, "test.swf");
}
}
}
编辑:我对 recv 毫无疑问,这是 apimonitor 告诉我的:
# TID Module API Return Error
5 2696 Flash10l.ocx recv ( 1992, 0x07080000, 65536, 0 ) 1
那么,有人可以帮助我吗?
最佳答案
问题已解决。造成麻烦的线路是
CreateRecvHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
我改成了
CreateRecvHook.ThreadACL.SetInclusiveACL(new Int32[] { 0 });
现在一切正常。谢谢大家:)
关于c# - EasyHook recv 不是 "hook"所有数据包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4589328/
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 8 年前。 Improve t
美好的一天, 我正在用 VC++ 开发一个应用程序,它使用 UDP 协议(protocol)与 Windows XP 上的 winsock 进行通信。以前我已经能够假设该工具接收到的所有数据包都来自一
所以我需要从服务器向客户端接收一个 html 文件,该文件比缓冲区大所以我发送了几次。这就是为什么我在接收时有这个循环 while (i = recv(s, buf, TAM_BUFFER, 0))
我有几个关于 C 中的套接字库的问题。这是我将在问题中引用的代码片段。 char recv_buffer[3000]; recv(socket, recv_buffer, 3000, 0); 我如何决
当我的代码处于阻塞的 recv 调用中时,如果另一端重新启动,那么这一端的 recv 调用不会知道它,只会进入挂起状态。 如何避免这种情况? 最佳答案 默认情况下,如果连接的另一端在没有正确终止连接的
我有一个在平台上运行的 TCP 服务器,它从缓冲区读取字节并在一个发送调用中通过网络发送所有字节: send(sSocket.client_sock, base, frb_size, 0); frb_
假设以下代码(为了简单起见,我在这里省略了必要的错误处理): recv(sockfd, NULL, 0, MSG_PEEK); recv(sockfd, buff, bufflen, 0); 在那种情
我想用 ansible 安装 facebook osquery。 ubuntu的使用说明如下: sudo apt-key adv --keyserver keyserver.ubuntu.com --
我遇到了 recv() 和 send() winsock api 的问题。 Recv() 在接收最后一个数据包时挂起。 问题描述:- 系统 A 的应用正在通过非阻塞套接字写入数据,而系统 B 的应用正
我正在构建一个 TCP 应用程序,它使用换行符 \n 来分隔未知长度(但通常小于 64 字节)的消息。我正在寻找 this article非常有用。 是一次recv一个字符并检查它是否为换行符或r
我使用 epoll 实现 TCP 套接字通信来监视所有客户端事件,只有一个线程在一个 for 循环中处理所有客户端。每个套接字都是非阻塞的。 现在我遇到了一个问题,当客户端发送的数据超过MTU时,意味
在python中,方法是: socket.recv(bufsize[, flags]) 在C中,方法是: int recv( _In_ SOCKET s, _Out_ char *buf, _In_
如果我有一个套接字 s 会发生什么,它上面当前没有可用数据,它是一个阻塞套接字,我从两个套接字上调用 recv线程一次?其中一个线程会获取数据吗?双方都会得到吗?第二次调用 recv 会返回错误吗?
我有一个非常烦人的问题,我在其他论坛上发现了几次,但是找不到合适的解决方案。 问题是recv()在连接的最后几个字节上返回0。以下是一些背景信息。 两种(客户端/服务器)应用程序都在同一台计算机上运行
我正在使用 C 语言在 Unix 上编写客户端/服务器程序,使用发送/接收。我偶尔会从 recv 调用中遇到段错误。该行为不能完全重现;有时它会发生,有时程序会运行到完成。 知道这意味着什么吗? 最佳
我想 mock 套接字的recv函数并遇到麻烦。即使我没有必要,也要获取实际上连接套接字所需的错误。 这是所有相关代码: Class A: def __init__.py(self):
我已经编写了一个服务器-客户端程序,我想问一问:32位和64位操作系统之间recv()函数的行为是否有所不同。 我之所以这样问是因为我在64位笔记本电脑上同时运行服务器和客户端,并且一切正常。我这样调
我有许多设备需要从中获取状态更新。我只需要一个套接字对象,而我只需要 socket.recv() 来获取状态。放入单线程应用程序,不会出现问题: class Device: def recei
在 C 中,我希望读取页面的 html,但我希望保存数据的缓冲区是动态的。我知道我必须通过循环和使用 realloc 来执行此操作但我不太确定我将如何去做。假设我的套接字( sock )已经打开,请考
这个循环应该逐行从套接字中获取数据并将其放入缓冲区。出于某种原因,当没有新数据返回时, recv 返回它得到的最后几行。我能够通过注释掉第一个 recv 来阻止这个错误,但是我不知道下一行会有多长时间
我是一名优秀的程序员,十分优秀!