美文网首页
关闭Windows高危端口

关闭Windows高危端口

作者: sakaizhu | 来源:发表于2019-03-29 14:53 被阅读0次

    @echo off

    color 1f

    title 关闭135 137 138 139 445 端口

    netsh ipsec static add policy name=HW_Policy

    netsh ipsec static add filterlist name=HW_FilterBlock

    netsh ipsec static add filter filterlist=HW_FilterBlock srcaddr=Any dstaddr=Me dstport=135 protocol=TCP

    netsh ipsec static add filter filterlist=HW_FilterBlock srcaddr=Any dstaddr=Me dstport=137 protocol=UDP

    netsh ipsec static add filter filterlist=HW_FilterBlock srcaddr=Any dstaddr=Me dstport=138 protocol=UDP

    netsh ipsec static add filter filterlist=HW_FilterBlock srcaddr=Any dstaddr=Me dstport=139 protocol=TCP

    netsh ipsec static add filter filterlist=HW_FilterBlock srcaddr=Any dstaddr=Me dstport=445 protocol=TCP

    netsh ipsec static add filteraction name=HW_Block action=block

    netsh ipsec static add rule name=HW_RuleBlock policy=HW_Policy filterlist=HW_FilterBlock filteraction=HW_Block

    netsh ipsec static set policy name=HW_Policy assign=y

    pause

    netsh ipsec static show filterlist name=HW_FilterBlock level=verbose format=table | findstr "TCP" | findstr "135"

    netsh ipsec static show filterlist name=HW_FilterBlock level=verbose format=table | findstr "UDP" | findstr "137"

    netsh ipsec static show filterlist name=HW_FilterBlock level=verbose format=table | findstr "UDP" | findstr "138"

    netsh ipsec static show filterlist name=HW_FilterBlock level=verbose format=table | findstr "TCP" | findstr "139"

    netsh ipsec static show filterlist name=HW_FilterBlock level=verbose format=table | findstr "TCP" | findstr "445"

    ::如需删除此安全策略,请执行如下命令:

    ::netsh ipsec static delete rule name=HW_RuleBlock policy=HW_Policy

    ::netsh ipsec static delete filteraction name=HW_Block

    ::netsh ipsec static delete filterlist name=HW_FilterBlock

    ::netsh ipsec static delete policy name=HW_Policy

    @echo on

    相关文章

      网友评论

          本文标题:关闭Windows高危端口

          本文链接:https://www.haomeiwen.com/subject/advlbqtx.html