论坛: 编程破解 标题: TracertInTheBat 复制本贴地址    
作者: ALLyeSNO [allyesno]    论坛用户   登录
那位老哥能给帮忙弄一个极简单的批处理:
功能是在文件中读出IP地址,然后运行tracert,如果有time out,就终止,然后将输出写到文件中
我搞了半天,搞不定呀


rem Build and Test by ALLyeSNO in WIN2K&WINXP
@echo off
cls
echo Build and Test by ALLyeSNO in WIN2K^&WINXP
echo.
echo 程序默认检查5个跃点,以及使用当前目录的ip.txt文件为ip数据库
echo 你也可以指定跃点数以及ip数据库文件名
echo use1:tip
echo use2:tip 跃点数 ip数据库(tip 30 iplog.txt)
echo.
set notimedout=0
set skip=0
set numberip=1
set notimedout=0
set numberline=0
if "%2"=="" set ipfile=ip.txt&&goto yd
set ipfile=%2
if not exist %ipfile% echo 没有找到%ipfile%文件,测试中止&&goto endx
:yd
if not exist ip.txt echo 没有找到ip.txt文件,测试中止&&goto endx
if "%1"=="" set yd=5&&goto gogogo
set yd=%1
:gogogo
for /f %%a in (%ipfile%) do set/a numberline=numberline+1
if "%numberline%"=="0" echo ip数据库内没有可用ip&&goto endx
:freexploit
if "%notimedout%"=="1" goto nexttest
set numbertracert=1
echo 目前正在检测1个ip
for /f %%a in (%ipfile%) do set tempip=%%a&&goto allyesno
:nexttest
if "%numberip%"=="%numberline%" echo.&echo 本次测试没有发现任何ip有timed out的情况出现&goto endx
set/a numberip=numberip+1
echo.
echo 目前正在检测第%numberip%个ip
set numbertracert=1
set/a skip=skip+1
for /f "skip=%skip%" %%a in (%ipfile%) do set tempip=%%a&&goto allyesno
:allyesno
echo 正在测试%tempip%的第%numbertracert%个跃点,请稍候
tracert -d -h %numbertracert% %tempip%|find "timed out"&&echo.>>rp.txt&&echo %date% %time%在检测%tempip%的第%numbertracert%个跃点时出现了timed out的情况>>rp.txt&&tracert -d -h %numbertracert% %tempip%|find "timed out">>rp.txt&&goto end
if "%yd%"=="1" goto end
if "%numbertracert%"=="%yd%" set notimedout=1&goto freexploit
set/a numbertracert=numbertracert+1
goto allyesno
:end
echo.
if not exist rp.txt echo 本次测试没有发现任何ip有timed out的情况出现&goto endx
type rp.txt
:endx


[此贴被 ALLyeSNO(allyesno) 在 10月15日18时28分 编辑过]

地主 发表时间: 04-10-15 18:27

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号