原文:MAC随机修改批处理
- @echo off
- mode con cols=70 lines=20
- title MAC随机修改工具
- color 3F
- setlocal enabledelayedexpansion
- :start
- cls
- echo ┏━━┓我 ●╭○╮ 我┏━━┓
- echo ┃天长┃愛 /█∨█\ 想┃永远┃
- echo ┃地久┃你 ∏ ∏ 你┃拥有┃
- echo ┗━━┛. 我爱你一万年 ┗━━┛
- echo MAC随机修改工具
- echo ----------------------------------------------------
- echo 本地网卡:
- ipconfig /all|find "Description">%temp%\des.txt
- devcon find pci\*>%temp%\pci.txt
- call :getPCI 1
- call :getMAC 1
- echo !pci!
- echo Physical Address:%MAC%
- echo.
- echo [1] 随机修改MAC地址
- echo [2] 查看IP地址
- echo [3] 退出本程序
- echo ----------------------------------------------------
- set /p choice= 请选择:
- if "%choice%"=="1" (
- call :setMAC
- call :getMAC 2 !MAC!
- call :getPCI 2
- echo MAC随机修改成功
- pause
- ) else if "%choice%"=="2" (
- echo IP Address...
- for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^|find "IP Address"') do (
- echo %%i
- )
- pause
- ) else if "%choice%"=="3" goto end
- goto start
- :setMAC
- if not exist MAC.txt (
- echo 没有找到存储MAC的文件MAC.txt,请在该程序目录下建立
- echo MAC.txt并存储MAC地址,每一个地址占一行!!!
- pause>nul
- goto start
- )
- set /a var=0
- for /f %%i in (MAC.txt) do set /a var=!var!+1
- set /a var=!random!%%!var!+1
- set /a tmp=0
- for /f %%i in (MAC.txt) do (
- set /a tmp=!tmp!+1
- if !tmp!==!var! (
- set MAC=%%i
- goto :eof
- )
- )
- goto :eof
- :getMAC
- for /f "skip=11" %%i in ('reg query HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}') do (
- for /f "skip=4 tokens=2,*" %%j in ('reg query %%i /v DriverDesc') do (
- if %%k==!pci! (
- if %1==1 (
- for /f "skip=4 tokens=2,*" %%l in ('reg query %%i /v networkaddress') do (
- set MAC=%%m
- goto :eof
- )
- )
- if %1==2 (
- reg add %%i /v networkaddress /d %2 /f>nul
- goto :eof
- )
- )
- )
- )
- goto :eof
- :getPCI
- for /f "tokens=2 delims=:" %%i in (%temp%\des.txt) do (
- for /f "tokens=2 delims=&" %%j in ('type "%temp%\pci.txt"^|find "%%i"') do (
- if %1==1 (
- set pci=%%i
- set pci=!pci:~1,-1!
- goto :eof
- )
- if %1==2 (
- echo 正在禁用网卡...
- devcon disable *%%j*>nul
- echo 正在启用网卡...
- devcon enable *%%j*>nul
- )
- )
- )
- goto :eof
- :end
- if exist %temp%\des.txt del %temp%\des.txt
- if exist %temp%\pci.txt del %temp%\pci.txt
在别人论坛看到这么个批处理
r
转发到本站来给大家做做研究
附件:mac随机修改批处理
时间: 2024-10-24 05:59:24