C#嗅探器 - 收到的数据
问题描述:
我试图在C#和Google中编写嗅探器,我发现this教程。我添加到类TCPHeaderC#嗅探器 - 收到的数据
string wiad = Encoding.UTF8.GetString(byTCPData);
if (wiad.Contains("|"))
MessageBox.Show(wiad);
要查看收到的消息,但我只能看到发送的数据包。我应该如何修改它以查看收到的数据呢?
答
你可以实现基于fiddler核心库的嗅探器,我认为这是更好的选择。由于
FiddlerCore - 提琴手代理引擎www.fiddler2.com/core/
答
我遇到过同样的问题,终于发现这是禁止您嗅传入包中的Windows防火墙你的.NET应用程序。关闭Windows防火墙后,它将工作。 在Win10,你可以关闭它在控制面板中,或者使用命令 netsh advfirewall set allprofiles state off
或使用C#这样的代码
public static void TurnOffFireWall()
{
// Have only been tested in Win10
Process proc = new Process();
string top = "netsh.exe";
proc.StartInfo.Arguments = "advfirewall set allprofiles state off";
proc.StartInfo.FileName = top;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
}
请注意,我只测试它在win10,在其他系统中,该命令可能有点不同。
寻找另一个教程? (顺便说一下,你发布的代码与你的问题并不相关) – Vlad