bat 批量封堵ip ,适用于win2003 windows2008

@echo off
rem "curl get ip.txt from remote"
rem curl\curl.exe -s -o d:\ip.txt http://x.x.x.x/ip.txt
netsh ipsec static set policy name="phpsir-deny-policy" assign=n
netsh ipsec static delete policy name="phpsir-deny-policy"
netsh ipsec static add policy name="phpsir-deny-policy" 

  
netsh ipsec static add filteraction name="phpsir-deny" action=block


for /f "tokens=*" %%a in (ip.txt) do call :processline %%a
netsh ipsec static set policy name="phpsir-deny-policy" assign=y
pause
goto :eof

:processline
echo line=%*
netsh ipsec static add filter filterlist=deny %* srcaddr=%* srcport=0 dstaddr=me dstport=0 protocol=0 mirrored=yes
netsh ipsec static add rule name=%* policy=phpsir-deny-policy filterlist=deny %* filteraction=phpsir-deny

goto :eof


:eof


发表评论

邮箱地址不会被公开。 必填项已用*标注