- @echo off
- title 创建IP安全策略,屏蔽135、139、445等端口
- echo “正在关闭,请等待”
- netsh ipsec static add policy name=whds
- netsh ipsec static add filterlist name=Filter1
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=135 protocol=TCP
- echo “135端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=136 protocol=TCP
- echo “136端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=137 protocol=TCP
- echo “137端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=138 protocol=TCP
- echo “138端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=139 protocol=TCP
- echo “139端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=445 protocol=TCP
- echo “445端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=1443 protocol=TCP
- echo “1443端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=1444 protocol=TCP
- echo “1444端口已经关闭”
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=135 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=136 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=137 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=138 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=139 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=445 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=1443 protocol=UDP
- netsh ipsec static add filter filterlist=Filter1 srcaddr=any dstaddr=Me dstport=1444 protocol=UDP
- netsh ipsec static add filteraction name=FilteraAtion1 action=block
- netsh ipsec static add rule name=Rule1 policy=whds filterlist=Filter1 filteraction=FilteraAtion1
- netsh ipsec static set policy name=whds assign=y
- echo “危险端口已经关闭,按任意键退出”
- pause
将上面代码复制到文档,然后另存为.bat格式就可以了。
版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
评论