读取文件批量查询域名的相关记录的bat脚本以及shell脚本

bat脚本

@echo off
set "file=dns.txt"
for /f "usebackq tokens=1* " %%a in ("%file%") do (
echo %%a
nslookup -timeout=2 -type=mx -retry=2 %%a 114.114.114.114 | find "MX"
)

shell脚本

for kk in `cat dns.txt`
do
mx=`dig -t mx  $kk  |  grep -v "^;" | grep MX | awk -F" " '{print $6}'`
echo $kk $mx
done

脚本下载点此

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