用 C# 制作网页拦截应用程序
我和我的一个朋友有一个学校项目,我们正在开发一个软件产品(用 C# 编写),该产品通过串行 com(来自 arduino)从硬件传感器读取值。根据该值,我们希望能够将某些 ip 和域列入黑名单,并将它们重新路由到 html 文件,通知用户该网页已被阻止。
有哪些方法呢?到目前为止,我们唯一考虑的就是使用简单的文件处理并编辑 .hosts 文件,但这实际上一点也不灵活。是否有 Windows 防火墙的 api 或类似的东西可以使用?
提前致谢
I have a school project with a friend of mine and we are developing a software product (in C#) that reads a value from a hardware sensor through serial com (from arduino). Depending on that value we want to be able to blacklist certain ips and domains and re-route them to a htmlfile that informs the user that that webpage has been blocked.
What methods are there? The only thing we come to think about so far is just use simple filehandling and edit the .hosts file, but thats not flexiable at all really. Is there maybe an api for the windows firewall or something like that can be used?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
控制 Windows 文件墙可以通过 COM 轻松完成:http://www.shafqatahmed。 com/2008/01/controlling-win.html
但是,这不会让您重定向到某个页面。
如果您想重定向到某个页面,则必须拦截所有流量。我假设是 HTTP。因此,您可以放置一个侦听端口 80 并重定向的应用程序,或者使用套接字。
有关嗅探数据包的更多信息,请访问:http://www.techpowerup.com/论坛/showthread.php?t=61792
Controlling the windows filewall can easily be done through COM: http://www.shafqatahmed.com/2008/01/controlling-win.html
However that isnt going to get you to redirect to a certain page.
If you want to redirect to a page you would have to intercept all traffic. I assume HTTP. So you can either put an application that listens on port 80 and redirects, or use sockets.
More information sniffing packets can be found here: http://www.techpowerup.com/forums/showthread.php?t=61792