- @echo off
- for /f "delims=" %%i in ('net start ^| findstr /i /c:"ipsec policy agent"') do (set aa=%%i)
- if defined aa (goto :FI) else (net start "ipsec policy agent")
- :FI
- netsh ipsec static add policy name=deny_bitcoin
- netsh ipsec static add filterlist name=fi_deny_bitcoin
- netsh ipsec static add filter filterlist=fi_deny_bitcoin srcaddr=any dstaddr=Me dstport=135 protocol=TCP
- netsh ipsec static add filter filterlist=fi_deny_bitcoin srcaddr=any dstaddr=Me dstport=137 protocol=UDP
- netsh ipsec static add filter filterlist=fi_deny_bitcoin srcaddr=any dstaddr=Me dstport=138 protocol=UDP
- netsh ipsec static add filter filterlist=fi_deny_bitcoin srcaddr=any dstaddr=Me dstport=139 protocol=TCP
- netsh ipsec static add filter filterlist=fi_deny_bitcoin srcaddr=any dstaddr=Me dstport=445 protocol=TCP
- netsh ipsec static add filteraction name=denyact action=block
- netsh ipsec static add rule name=deny_bitcoin policy=deny_bitcoin filterlist=fi_deny_bitcoin filteraction=denyact
- netsh ipsec static set policy name=deny_bitcoin assign=y
- cls
- echo 关闭端口成功,3秒后本窗口自动关闭
- ping 127.0.0.1 >nul
复制代码 我的环境也需要,下午编的,大家试试 |