具有高级安全性的 Windows 防火墙中的命令行 IP 阻止/取消阻止

发布于 2024-10-08 05:12:27 字数 694 浏览 0 评论 0原文

我希望能够以编程方式阻止发往某些 IP 的传出数据包。没关系应用程序,我希望能够做到这一点。

我有 Windows 7 x64 Professional,因此它配备了具有高级安全性的 WindowsFirewall,它具有出站过滤功能。

目前我正在手动添加规则来阻止 IP,但必须有更好的方法。

我读到了这个:任何方式来转动“使用 c# 在 Windows 中关闭互联网?http://msdn .microsoft.com/en-us/library/bb945065.aspx 所以我知道可以编写这样的应用程序。

我是一名java程序员,我找不到jni来与firewall.dll交互。我对C#一无所知,无法自己写一个。

我问是否有一个工具可以做到这一点,请告诉我。我用谷歌搜索了一遍又一遍,但可惜的是——什么也没有。如果没有,请让我开始自己编写。

如果您觉得慷慨,您可以为我写一个,您可以阻止某个 IP 的出站流量并解除阻止。

非常感谢大家。

I'd like to programmatically be able to block outgoing packets to some IPs. Nevermind the application, I would like to be able to do it.

I have Windows 7 x64 Professional so it comes with WindowsFirewall with Advanced Security which has an outbound filter capability.

Currently I'm manually adding rules to block an IP, but there has got to be a better way.

I read this: Any way to turn the "internet off" in windows using c#? and http://msdn.microsoft.com/en-us/library/bb945065.aspx so I know it's possible to write such applications.

I'm a java programmer, and I couldn't find an jni to interface with firewall.dll. I don't know anything about C# to write one myself.

I'm asking if there a - there's a tool out there that can do this, please let me know about it. I've Googled and Googled, but alas - nothing. If there isn't please get me started on how to write it myself.

In case you're feeling generous, you could write one for me s.t. you could block outbound traffic to an IP and unblock it.

Thank you all very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅语花开 2024-10-15 05:12:27

最直接的方法就是运行 netsh,这里有一篇文章 关于如何做

The most straightforward way would be just to run netsh, here's an article on how to do it

生来就爱笑 2024-10-15 05:12:27

netsh 的现代替代品是 powershell。命令 Enable-NetFirewallRuleDisable-NetFirewallRule 允许您从 powershell 打开/关闭规则脚本。命令 Set-NetFirewallRule 允许您编辑现有的防火墙规则,如果您想更改规则正在影响的 IP 地址。您甚至可以使用 New-NetFirewallRule 添加新规则如果需要的话也可以。

A modern alternative to netsh is powershell. The commands Enable-NetFirewallRule and Disable-NetFirewallRule allow you to turn rules on/off from a powershell script. The command Set-NetFirewallRule allows you to edit an existing firewall rule, for if you want to change the ip address a rule is affecting. You could even add new rules using New-NetFirewallRule as well if needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文