set fileobj88=CreateObject("Scripting.FileSystemObject") Set MYFILE=fileobj88.OpenTextFile(f_name,1,false) contentover=MYFILE.ReadAll() contentip=lcase(contentover) MYFILE.close set fileobj88=nothing on error resume next myline=split(contentip,chr(13)) for i=0 to ubound(myline)-1
myline2=split(myline(i)," ") newip=myline2(6) '指定分离的标识字符串! if instr(overip,newip)=0 then '去除重复的IP。 overip=overip&newip dsafasf=split(newip,".") if ubound(dsafasf)=3 then writelog "netsh ipsec static add filter filterlist=denyip srcaddr="&newip&" dstaddr=Me
dstport=80 protocol=TCP" end if else wscript.echo newip &" is exits!" end if next writelog "netsh ipsec static add filteraction name=denyact action=block" writelog "netsh ipsec static add rule name=kill3389 policy=XBLUE filterlist=denyip
filteraction=denyact" writelog "netsh ipsec static set policy name=XBLUE assign=y"
Sub writelog(errmes) '导出IPsec的策略文件为一个bat文件。 ipfilename="denyerrorip.bat" Set logfile=fileobj.opentextfile(ipfilename,8,true) logfile.writeline errmes logfile.close Set logfile=nothing End Sub