Jump to content

Recommended Posts


This is for mac address spoofing.
Before a mod gives me the ban hammer for posting code such as this, id like to explain I recently had a necessity for it.
A lot of places use mac addresses to identify devices/machines and control internet permissions.
I myself love the xfinity wifi hotspots placed all around where I live as I can connect to them and save data usage instead of tethering my phone.
BUT! They use a captive portal with a webpage interface in javascript and (not too much to my surprise), wifey says some of her crap wont open that page.
I explained she can disable wifi on the device, use computer and spoof to the mac address of what she wants to use. Then sign into the portal as she would normally with computer.
Once connected, shut the computer down and enable wifi for that device again. Once enabled shes got net access. edit: Wife looked at me like I was speaking latin.....lol

;
;
; Function:  Set_Mac()
;
; Parameter(s):  $s_Desired_Mac        =    Need I really explain?
;                $s_Target_Net_Adapter =    Network adapter name (one can use the adapter index as well but thats less "user friendly"
;                $b_Toggle_Device      =    For my wife cuz it needs full automation for her to stop bothering me
;
; Author(s):     KingOfNothing credz to google & autoitscript.com members
;
;
;=====================================================================




Opt('MustDeclareVars', 0) ;cause its late in the morning and im just gonna trust this should still fly
#include <WinApi.au3>


$MacAddressRegKey = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007"
;                                                   ^^^ After making this I read online that this should be some "CurrentControlSet"
;                                                       key instead. However, I watched registry while changing things in adapter properties
;                                                       to see that key, which works fine on my 3 test machines....

;easy example
Set_Mac("Wireless Network Connection","",true)
;msgbox(0,"",Get_Mac())




Func Set_Mac($s_Targeted_Adapter, $s_Desired_Mac = "D20000000000",  $b_Toggle_Device = true )
Local $sMac, $s_Tmp, $val, $sVar = ""

$sMac = Get_Mac()
while stringlen($s_Desired_Mac)< 12 and stringlen($s_Desired_Mac)> 0   ;this will append zeros if mac length is too short
   $s_Desired_Mac = $s_Desired_Mac & "0"
wend

if stringlen($s_Desired_Mac)> 12 then  ;likewise if too many characters entered to function, then we should truincate some
$s_Desired_Mac = StringLeft ($s_Desired_Mac,12)
endif

;this creates a random mac address with very little actual thought behind it.
;Im sure theres some formal means to devising a valid mac address but this simple crap suits my needs atm....
if $s_Desired_Mac = "" then
      For $i = 1 To 10
        $sVar=  Chr(Random(48, 57, 1)) ;0-9
         $s_Tmp = $s_Tmp & $sVar
      Next
$s_Desired_Mac = "D2" & $s_Tmp
$s_Desired_Mac = StringUpper($s_Desired_Mac)
endif

$val = RegWrite($MacAddressRegKey, "NetworkAddress", "REG_SZ", $s_Desired_Mac)
if $val =0 then
   MsgBox(0,"Mac Address Changer ","Could not write to registry as needed to change your mac address!" & @CRLF & "Please restart this program with administrator rights!")
   Exit
endif



;in order to benifit from changing the registry, one must disable/re-enable the adapter.
;This cmd line query to wmic prevents the need to do so in device manager manually
if $b_Toggle_Device = true then
ShellExecuteWait  ("C:\Windows\System32\wbem\wmic.exe", "path win32_networkadapter where  NetConnectionID=" & chr(34) & $s_Targeted_Adapter & chr(34) & " call disable" ,"",$SHEX_OPEN,@SW_HIDE)
ShellExecuteWait  ("C:\Windows\System32\wbem\wmic.exe","path win32_networkadapter where  NetConnectionID=" & chr(34) & $s_Targeted_Adapter & chr(34) & " call enable" ,"",$SHEX_OPEN,@SW_HIDE)
endif
;Would be smart to catch the return of the function there in some varible for error handling, but its too late for me to give a crap atm....

MsgBox(0,"Mac Address Changer", "Old Mac = " & $sMac & @crlf & "New Mac = " &   $s_Desired_Mac)
clipput($s_Desired_Mac)
endfunc


Func Get_Mac()
Local $xRet
$xRet= RegRead($MacAddressRegKey, "NetworkAddress")
return $xRet
EndFunc

 

Sorry bout the messy penmenship. Aint looked at the tidy thing yet....ūüßź

Edited by KingOfNothing

Share this post


Link to post
Share on other sites

This is very cool. Thank you for the script. It will help me with something I want to make for security reasons. In case anyone cares, I will explain my concern. 

The other day, I searched for Merrell replacement soles for my shoes. My sister started getting ads for Merrell replacement soles on her cell phone. The only thing we have in common is we share wifi, nothing else. So, I found an article on this (https://www.technologyreview.com/s/538731/how-ads-follow-you-from-phone-to-desktop-to-tablet/). Basically, there are companies that predict which devices belong to the same user with information such as IP address, MAC address, etc. One way to combat this tracking is spoofing your MAC address. I was thinking of making something that changes my MAC address every 30 seconds. This might throw off the companies trying to target me. I guess a VPN would help, too.

On a side note, my sister and her husband went to a restaurant yesterday and paid in cash. This morning, he got an ad on his phone naming the restaurant and asked how they liked the restaurant. I guess they used his GPS location to tell they ate there. But I don't know how a company could get this information. It's getting scary out there.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nitron
      Hy All,
       
      again I got a question.
      I try to convert
      wmic PATH Win32_videocontroller GET adapterram
       
      i tried to to it like in this example but my knoledge is not good enough
         Local $oWMI = ObjGet("winmgmts:root\CIMV2")
         Local $oDisks = $oWMI.ExecQuery("select * from WIN32_DiskDrive")
       
      So i tired 
         Local $oWMI = ObjGet("winmgmts:root\CIMV2")
         Local $oGMRam= $oWMI.ExecQuery("Win32_videocontroller")
         $Memory=$oGMRam.adapterram
      but this does not work.
      I like to understand what i need to do?
       
    • By ahmet
      Hello,
      I am trying to make a program that will uninstall some software, provided by some form of a list. I have this
      ; Generated by AutoIt Scriptomatic June 08, 2010 ;#RequireAdmin $sPartialName="java" $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" ;$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") ;$objWMIService=ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") $objWMIService=ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems If StringInStr($objItem.Name,$sPartialName)=1 Then ConsoleWrite("Full name:" & $objItem.Name & @CRLF) RunAs("USERNAME",@ComputerName,"PASSWORD",0,@ComSpec & " /c" & ' wmic product where name="Java 9.0.4 (64-bit)" call uninstall /nointeractive',"C:\WINDOWS\system32\wbem",@SW_MAXIMIZE) ;Run('wmic product where name="Java 9.0.4 (64-bit)" call uninstall /nointeractive',"",@SW_MAXIMIZE) ExitLoop EndIf Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" ) Endif The script above fails uninstalling software despite providing username and password for admin account. If I run script with admin rights then the software gets uninstalled.
      At the following link there is a script by JLogan3o13 but it does not either uninstall software, unless run as admin..
      Is there some way to uninstall software using wim or wimc by providing user name and password?
       
    • By 31290
      Hello everyone, 
      I'm working on a WMIC uninstaller. A quite simple one with a button to display product names in a editable list (for copy/paste purposes) but the main problem is that in order to achieve this, in my corporation, normal users cannot uninstall softs.
      What I found/adapt so far:
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("wmic uninstaller", 300, 152, 337, 380) $Label1 = GUICtrlCreateLabel("Computername", 0, 8, 75, 17) $Input1 = GUICtrlCreateInput(@ComputerName, 0, 32, 125, 21) $Label2 = GUICtrlCreateLabel("wmic command", 150, 8, 77, 17) $Combo1 = GUICtrlCreateCombo("Model_Computer", 150, 32, 125, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Current_user|Installed_Apps|Serial_Number|Bios_Version") $Button1 = GUICtrlCreateButton("List Apps", 150, 72, 91, 49) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 $wmi = GUICtrlRead($combo1) $pc = GUICtrlRead($input1) call($wmi,$pc) EndSwitch WEnd Func Model_Computer($pc) RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' product get name > %temp%\apps.txt' ,"", @SW_HIDE) $file=(@TempDir & "/apps.txt") $fileread= FileRead($file) MsgBox(0, $pc , $fileread) FileDelete(@TempDir & "/apps.txt") EndFunc Here's the textual version I gave to my techs:
      Create cmd shortcut on Desktop, run it as a different user (using their own admin accounts). Once opened, type wmic Once wmic loaded, type product get name Wait for the list of installed soft to display Type product where name="Exact App name" call uninstall Type "Y" to confirm Wait for task execution Don't care about exit code App is uninstalled (verified by getting the list again)! In fact, I'd like to automatize this process.
      Any ideas over here?
      Thanks ^^
    • By theak
      Trying to make a script where it will run a command to show me the model name AND serial tag info on a laptop remotely and copy it to keyboard step by step. I know how to do this via WMIC but I'm curious how to create a CMD script out of it so I can just one click. So it would look something like....
      wmic csproduct get name *copy to clipboard* "Press enter to advance" [Enter] wmic csproduct get identifyingnumber *copy to clipboard* "Finished" Any ideas?
    • By careca
      Did this because i needed, retrieves a list of adapters from the registry, shows you your current Mac Address of the adapter in use, the user simply changes the second input field to the address he wants, then select the adapter on the list, and click 'set', after a reboot, the mac should be changed.
      (The field to input the mac to set accepts '-' ':' or no separation character. ex: AA:BB:CC... or AA-BB-CC... or AABBCC...)
×
×
  • Create New...