NotOnlyJava

http://www.ibm.com/developerworks/cn/java/j-lo-serial/
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Windows下单ip扫描工具

Posted on 2014-04-29 22:27  NotOnlyJava  阅读(465)  评论(0编辑  收藏  举报
@echo off

echo               IP Ping 工具
:x
::set /p choice="请输入扫描类型:A or B :"
set  choice=A
if /i %choice%==a goto ipduan else goto y
:y
if /i %choice%==b goto ip else goto x

@------scan ip------@
:ipduan 
    set /p ipAddress="输入IP网段(192.168.0):"
    set /p startIP="输入起始IP:"
    set /p endIP="输入结束IP:"
    echo scan from %ipAddress%.% startIP% to %ipAddress%.%endIP%
    for /l %%i in (%startIP%,1,%endIP%) do (call :ping %ipAddress%.%%i)

::-------检测结果------------::
for /f "delims=" %%a in ('dir /b "*.ip"') do (echo ------------>%%~na 可以Ping通!)
pause>nul

@--------this is telnet method-------@
:telnet (ip,port)
   set /p ipa="输入扫描的ip:(例如:192.168.0.1)"
   set /p port1="输入要扫描的开始端口:"
   set /p port2="输入要扫描的结束端口:"
   for /l %%i in (%port1%,1,%port2%) do (telnet %ipa% %%i)


@---------this is ping method-------@
:ping (ip)
  echo scaning %~1 ....
  start /b cmd /q /c "for /f "tokens=1-3 delims=(%%)" %%a in ('ping %~1 -n 1^|findstr "字节="') do (if not "%%a"=="" (echo %%a>"%~1.ip"))"