仅使用C#.Net阻止网络流量。 [英] Blocking Network Traffic Using C#.Net Only.

查看:102
本文介绍了仅使用C#.Net阻止网络流量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#监控网络流量.Net:

我现在想要的是通过阻止用于执行可疑行为的IP阻止可疑用户。



我想知道如何阻止来自特定IP的流量,

或我如何使用C#.Net删除或阻止数据包。



我不想使用Windows防火墙,我基本上想通过在C#.Net中编码我自己来执行这些操作。



C#中是否有任何图书馆,班级或任何代码可以帮助我这样做请告诉我。



您的帮助将不胜感激。 :)



谢谢。

I have monitored the network traffic using C#.Net:
what i want now is to Block a suspicious user by blocking IP that is used to perform a suspicious act.

I want to know that how can i block traffic coming from a particular IP,
or how can i drop or block packets using C#.Net.

I do not want to use windows firewall, i basically want to perform these things by Coding them my self in C#.Net.

Is there any Library, Class or any Code in C# that can help me do this please tell me.

your help will be appreciated. :)

Thank you.

推荐答案

你可以阻止任何事情,但只有当你的过程被放置时在交通中间某处。如果您的应用程序可以在未经用户明确同意的情况下将其自身挂在中间,您不明白这是否意味着另一个系统漏洞?



进入的一种方法获得用户同意的HTTP流将开发一些 Web代理服务器 ,应该是明确地由用户使用。例如,请参阅此代码示例: http://times.imkrisna .com / 2011/08 / simple-http-proxy-server-c-source-code [ ^ ]。



参见:

http://stackoverflow.com/questions/226784/如何创建一个简单的代理在c中的方式 [ ^ ],

http://bartdesmet.net/blogs/bart/archive/2007/02/22/httplistener-for-dummies- a-simple-http-request-reflector.aspx [ ^ ]。



另见这个CodeProject文章:在C#中实现多线程HTTP / HTTPS调试代理服务器 [ ^ ] 。



-SA
You could block anything, but only if your process is put in the middle of the traffic somewhere. If your application could hook itself in the middle by itself, without explicit user's consent, don't you understand that would mean another system vulnerability?

One way of getting into the HTTP stream with user consent would be development of some Web proxy server which should be explicitly put to use by the user. See, for example, this code sample: http://times.imkrisna.com/2011/08/simple-http-proxy-server-c-source-code[^].

See also:
http://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c[^],
http://bartdesmet.net/blogs/bart/archive/2007/02/22/httplistener-for-dummies-a-simple-http-request-reflector.aspx[^].

Also see this CodeProject article: Implementing a Multithreaded HTTP/HTTPS Debugging Proxy Server in C#[^].

—SA


这篇关于仅使用C#.Net阻止网络流量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆