Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- : class="re0">Change MAC by AveYo v3.0 / Wi-Fi Scan Toggle v1.0
- @ECHO OFF &SETLOCAL ENABLEEXTENSIONS
- GOTO :_INIT
- :_START
- CALL "%SSVAR%\cscript.exe" //nologo "%~f0?.wsf" //job:SCAN
- rem CALL "%SSVAR%\cscript.exe" //nologo "%~f0?.wsf" //job:MAC
- EXIT /B
- :_INIT
- CD /D "%~dp0"
- SET "SSVAR=%WINDIR%\SYSTEM32"
- IF DEFINED PROCESSOR_ARCHITEW6432 SET "SSVAR=%WINDIR%\Sysnative"
- MODE 80,2 &COLOR 70 &TITLE %~n0 by A^v^eY^o^ v3^.^0
- IF "%1"=="_SELF_ADMIN" SHIFT &SHIFT &GOTO :_START
- "%SSVAR%\REG.EXE" QUERY "HKEY_USERS\S-1-5-20\Environment" /v TEMP 2>NUL 1>&2 && GOTO :_START || echo Requesting admin rights, if it fails, R-click and 'Run As Administrator' &COLOR 0c
- CALL "%SSVAR%\cscript.exe" //nologo "%~f0?.wsf" //job:ADM "%~f0" &EXIT
- GOTO :eof
- ----- embeded wsh scripts --->
- <package>
- <job id="ADM">
- <script language="VBScript">
- On Error Resume Next
- CreateObject("Shell.Application").ShellExecute WScript.Arguments(0), "_SELF_ADMIN " & WScript.Arguments(0), "", "runas", 1
- Err.Clear
- </script>
- </job>
- <job id="SCAN">
- <script language="VBScript">
- On Error Resume Next
- const HKEY_LOCAL_MACHINE = &H80000002
- Dim aName,aIndex,aInterface,aType,aChoice,aScan,aAutoconfig
- Set aREG=GetObject("winmgmts:StdRegProv")
- aKey = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
- Set aWMI = GetObject ("winmgmts:") '48=wbemFlagForwardOnly + wbemFlagReturnImmediately
- Set adapters = aWMI.ExecQuery("Select NetEnabled,PhysicalAdapter,PNPDeviceID,ProductName,Index,NetConnectionID from Win32_NetworkAdapter where PhysicalAdapter=True and (PNPDeviceID LIKE '%USB%' or PNPDeviceID LIKE '%PCI%')","WQL",48)
- For Each adapter in adapters
- With adapter
- aName = .ProductName
- aIndex = "\" & Right("0000" & .Index, 4)
- aInterface = .NetConnectionID
- aREG.GetDWORDValue HKEY_LOCAL_MACHINE,aKey & aIndex,"*MediaType",aType
- If aType = 16 Then
- aChoice = MsgBox(chr(34) & aInterface & chr(34) & vbCrLf & aName & vbCrLf & vbCrLf & "Press Yes to Disable autoconfig (Background Scan OFF)" & vbCrLf & "Press No to Enable autoconfig (Background Scan OFF)" & vbCrLf & "Press Cancel to Reset (Background Scan ON)",67,"Wi-Fi Scan Toggle by AveYo")
- aScan = "0" : If aChoice = vbCancel Then aScan = &H1 Else aScan = &H0 End If
- If aChoice = vbYes Then aAutoconfig="no" Else aAutoconfig="yes" End If
- aREG.SetDWORDValue HKEY_LOCAL_MACHINE,aKey & aIndex,"bkScanEnable", aScan '(only works for Atheros / Killer)
- aREG.SetDWORDValue HKEY_LOCAL_MACHINE,aKey & aIndex,"ScanWhenAssociated", aScan '(only works for Intel)
- CreateObject("Shell.Application").ShellExecute "netsh", "wlan set autoconfig enabled=" & aAutoconfig & " interface=" & chr(34) & aInterface & chr(34), "", "", 0
- End If
- End With
- Next
- Err.Clear
- </script>
- </job>
- <job id="MAC">
- <script language="VBScript">
- On Error Resume Next
- const HKEY_LOCAL_MACHINE = &H80000002
- Dim aName,aMAC,aIndex,filterMAC
- Set aREG=GetObject("winmgmts:StdRegProv")
- aKey = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
- aValue = "NetworkAddress"
- Set aWMI = GetObject ("winmgmts:") '48=wbemFlagForwardOnly + wbemFlagReturnImmediately
- Set adapters = aWMI.ExecQuery("Select PhysicalAdapter,PNPDeviceID,ProductName,Index,NetEnabled from Win32_NetworkAdapter where PhysicalAdapter=True and (PNPDeviceID LIKE '%USB%' or PNPDeviceID LIKE '%PCI%')","WQL",48)
- For Each adapter in adapters
- With adapter
- aName = .ProductName
- aIndex = "\" & Right("0000" & .Index, 4)
- aREG.GetStringValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue,aMAC
- If IsNull(aMAC) Then aMAC=""
- changeMAC=Trim(InputBox(aName & vbCrLf & vbCrLf & "Enter new MAC address: (any separator .,: works)" & vbCrLf & "or 0 to reset it", "ChangeMac by AveYo", aMAC))
- filterMAC=Split("._ _,_:_;_-_<_>_[_]_{_}_(_)","_")
- For each x in filterMAC
- changeMAC=Replace(changeMAC,x,"")
- WScript.Echo changeMAC
- Next
- If changeMAC <> aMAC And changeMAC <> "" Then
- If changeMAC="0" Then aREG.DeleteValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue Else aREG.SetStringValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue,changeMAC End If
- 'If (.NetEnabled) Then adapter.disable() Else adapter.enable()
- 'If Not (.NetEnabled) Then adapter.enable() Else adapter.disable()
- End If
- End With
- Next
- Err.Clear
- </script>
- </job>
- </package>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement