ip去重小脚本
奇安信威胁情报中心
长亭漏洞情报库 | 长亭百川云
ip去重脚本.bat
@echo off
set fileA=banned.txt
set fileB=check.txt
set fileC=white_list.txt:: 检查文件是否存在
if not exist "%fileA%" (echo file %fileA% not existspauseexit /b
)if not exist "%fileB%" (echo file %fileB% not existspauseexit /b
)if not exist "%fileC%" (echo file %fileC% not existspauseexit /b
)::会改变行顺序,/y强制覆盖,/f强制删除,/q静默模式不提示确认,2>&1隐藏所有输出
sort %fileA% /unique > tmp.txt
move /y tmp.txt %fileA%
del /f /q "tmp.txt" >nul 2>&1sort %fileB% /unique > tmp.txt
move /y tmp.txt %fileB%
del /f /q "tmp.txt" >nul 2>&1sort %fileC% /unique > tmp.txt
move /y tmp.txt %fileC%
del /f /q "tmp.txt" >nul 2>&1
ip检查脚本.bat
检查check.txt的每一行是否出现在封禁名单或者白名单里
@echo off
setlocal enabledelayedexpansion:: 设置文件路径
set fileA=check.txt
set fileB=white_list.txt
set fileC=banned.txt:: 检查文件是否存在
if not exist "%fileA%" (echo file %fileA% not existspauseexit /b
)
if not exist "%fileB%" (echo file %fileB% not existspauseexit /b
)if not exist "%fileC%" (echo file %fileC% not existspauseexit /b
):: 打开文件(可选)
start /min "" notepad.exe "%fileA%"
start /min "" notepad.exe "%fileB%"
start /min "" notepad.exe "%fileC%":: 比较文件内容
set found=0
for /f "tokens=*" %%a in (%fileA%) do (findstr /x /c:"%%a" "%fileB%" >nul && (set found=1goto :result)findstr /x /c:"%%a" "%fileC%" >nul && (set found=1goto :result)
):result
if !found! equ 1 (echo intersect
) else (echo not intersect
)::关闭记事本
taskkill /f /im notepad.exe
pause
white_list.txt
223.5.5.5
223.6.6.6
8.8.8.8
114.114.114.114
check.txt
8.8.8.8
114.114.114.114
banned.txt
a-gwas-01.slyip.net
a.gwas.perl.sh
a1.6cs6.club
aaa.28lcp7.dnslog.cn
ahmediye.net
althawry.org
apple-pie.in
arthur.niria.biz
cb1.bwig05.ceye.io
coco.miniast.com
fbi.bot.nu
hot.tenchier.com
iron.tenchier.com
orzdwjtvmein.in
qwe.nnnafewujsey.bond
qwe14.qpon
rim.miniast.com
rx.thegov.win
sq.szmr.org
t.zz3r0.com
unable.download
v.beahh.com
www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com
z.totonm.com
qq.leehei.xyz
45.230.66.123
106.8.138.19