Sign in to follow this  
Followers 0
palotex

Change the mac address

19 posts in this topic

hi,

this is my first script, i use to change the mac address of my network address without rebooting the computer.

it works on my pc

#include <GuiListView.au3>
#include <guitab.au3>
#Include <GuiListBox.au3>
#include <GuiEdit.au3>
#include <array.au3>


 if not Ping("www.google.com",250)  Then
      MsgBox(0,"","Sin conexion?????")
      Exit
 EndIf



Global $nuevamac = InputBox ("Introduce la nueva MAC","Recuerda que son de este formato 0016E6DAED73")
StringUpper ($nuevamac)
if StringLen($nuevamac) <> 12 then 
    MsgBox(0,"--------------ATENCION-----------","ERROR.... Tienes que poner 12 caracteres hexadecimales")
    exit
EndIf
if not StringIsXDigit($nuevamac)  Then
    MsgBox(0,"-------------ERROR-------------","La MAC , SOLO debe de ser hexadecimal 0-9 , A-F")
    Exit
EndIf
Run("RunDll32.exe shell32.dll,Control_RunDLL ncpa.cpl")
sleep(1000)
$hWnd = WinGetHandle("Network Connections" or "Conexiones de red")
$title = "Network Connections"
$title2 = "Conexiones de Red"
$hListView = ControlGetHandle($hWnd, "", "SysListView321")
$idx = _GUICtrlListView_FindInText($hListView, $title or $title2)
_GUICtrlListView_SetItemSelected ($hListView, $idx)
_GUICtrlListView_SetItemFocused ($hListView, $idx)
ControlSend($hWnd, "", "SysListView321", "{SPACE}")
ControlSend($hWnd, "", "SysListView321", "{Enter}")
winclose("")
ControlClick("", "", "[CLASSNN:Button3]")
winclose("")
ControlClick("", "", "[CLASSNN:Button1]")
winclose("")
$hWnd3 = WinGetHandle("Ethernet Controller")
$systab = ControlGetHandle($hWnd3, "", "SysTabControl321")
$ItemCount = _GUICtrlTab_GetItemCount($systab)
send("{TAB}")
send("{TAB}")   
send("{TAB}")
send("{TAB}")
Send("{RIGHT}")
winwait("")                     
$hListView = ControlGetHandle($hWnd3, "", "ListBox1")
$items = _GUICtrlListBox_GetCount($hListView)
sleep(1500)
send("{tab}")
send("{down}")
send("{down}")
send("{down}")
send("{down}")
send("{down}")
send("{down}")
send("{down}")
$heditbox = ControlGetHandle($hWnd3, "", "Edit1")
_GUICtrlEdit_SetText($heditbox, $nuevamac)
ControlClick("", "", "[CLASSNN:Button3]")

Share this post


Link to post
Share on other sites



Instead of clicking through there is a simpler way of doing it using the command prompt.

and the simplier way it's?

Share this post


Link to post
Share on other sites

yes, but rebooting the pc

with the script , no need rebooting

sorry about my english.....

Share this post


Link to post
Share on other sites

ups, i didnt read it..... :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

A long time ago, I made something like it:

http://www.autoitscript.com/forum/index.php?showtopic=42018

Edited by A. Percy

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator[center] VW Bug user[/center]Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral

Share this post


Link to post
Share on other sites

try this,

only for 2000, xp or 2003 server

Share this post


Link to post
Share on other sites

try this,

only for 2000, xp or 2003 server

uffffffff, it's a great work....

thank you psandu.ro

Share this post


Link to post
Share on other sites

This a the transcription in autoit of this procedure

#include <Array.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$Regkey1 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network"
$i = 1
$h = 0

Dim $check1 = 0
Dim $Connexion_name[15][3]
Dim $Net_adapt_sid[1]
While $check1 = 0
    $Subkey = RegEnumKey($Regkey1, $i)
    $test = RegRead($Regkey1 & "\" & $Subkey, "Class")
    Select
        Case $test = "Net"
            $j = 1
            $check2 = 0
            Do
                $test2 = RegEnumKey($Regkey1 & "\" & $Subkey & "\" & RegEnumKey($Regkey1 & "\" & $Subkey, $j), 1)
                If @error = 1 Then $check2 = 1
                If $test2 = "Connection" Then
                    $value = RegRead($Regkey1 & "\" & $Subkey & "\" & RegEnumKey($Regkey1 & "\" & $Subkey, $j) & "\Connection", "Name")
                    Select
                        Case @error = 0
                            $Connexion_name[$h][0] = $value
                            $Connexion_name[$h][1] = RegEnumKey($Regkey1 & "\" & $Subkey, $j)
                            $Connexion_name[$h][2] = $Subkey
                            $h += 1
                    EndSelect
                EndIf
                $j += 1
            Until $check2 = 1
            $check1 = 1
    EndSelect
    $i += 1
WEnd

$h = 0
$combolist = ""
Do
    If $combolist = "" Then
        $combolist &= $Connexion_name[$h][0]
    Else
        $combolist &= "|" & $Connexion_name[$h][0]
    EndIf

    $h += 1
Until $Connexion_name[$h][1] = ""

$Form1 = GUICreate("Form1", 179, 194, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Combo1 = GUICtrlCreateCombo("", 16, 69, 145, 25)
GUICtrlSetData($Combo1, $combolist, "...")
GUICtrlSetOnEvent($Combo1, "Combo1Change")
$Input1 = GUICtrlCreateInput("", 16, 24, 145, 21)
$Label1 = GUICtrlCreateLabel("Mac Address to change", 16, 4, 117, 17)
$Label2 = GUICtrlCreateLabel("Network adapter", 16, 52, 147, 17)
$Button1 = GUICtrlCreateButton("Change", 16, 156, 143, 25, 0)
GUICtrlSetOnEvent($Button1, "Button1Click")
$Input2 = GUICtrlCreateInput("", 16, 124, 145, 21)
GUICtrlSetOnEvent($Input2, "Input2Change")
$Label3 = GUICtrlCreateLabel("Desired Mac Address", 20, 104, 105, 17)
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Button1Click()
    ;RegWrite($G_Reg,"NetworkAddress","REG_SZ",GUICtrlRead($Input2)
    ;disable, enable the adapter with netsh
    rundos('netsh interface set interface "'&GUICtrlRead($Combo1)&'" DISABLE')
        rundos('netsh interface set interface "'&GUICtrlRead($Combo1)&'" ENABLE')

EndFunc   ;==>Button1Click
Func Combo1Change()
    Dim $error
    $h = 1
    Do
        $Regkey2 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\" & $Connexion_name[$h - 1][2]
        If GUICtrlRead($Combo1) = $Connexion_name[$h - 1][0] Then
            $j = 1
            Do
                $t=RegEnumKey($Regkey2, $j)
                $test = RegRead($Regkey2 & "\" & RegEnumKey($Regkey2, $j), "NetCfgInstanceId")
                $error = @error
                If $test = $Connexion_name[$h - 1][1] Then
                    Global $G_Reg = $Regkey2 & "\" & RegEnumKey($Regkey2, $j)
                    ;$s=GetAdaptersList($t)
                    ;MsgBox(0, "", $G_Reg,1)
                EndIf
                $j+=1
            Until $error=1
        EndIf
        $h += 1
    Until $Connexion_name[$h -1][1] = ""
EndFunc   ;==>Combo1Change

Func Form1Close()
    Exit
EndFunc   ;==>Form1Close

Func Input2Change(); was supposed to change xxxxxxxxxx to xx-xx-xx-xx-xx-xx,but onevent over an input box seems doesn't work
    if StringLen(GUICtrlRead($Input2))=2 Or StringLen(GUICtrlRead($Input2))=5 or StringLen(GUICtrlRead($Input2))=8 Or StringLen(GUICtrlRead($Input2))=11 or StringLen(GUICtrlRead($Input2))=14 Then
        GUICtrlSetData($Input2,GUICtrlRead($Input2)&"-")
    EndIf
        
EndFunc   ;==>Input2Change

Share this post


Link to post
Share on other sites

try this,

only for 2000, xp or 2003 server

太有帮助了,谢谢啦!

Share this post


Link to post
Share on other sites

太有帮助了,谢谢啦!

"太有帮助了,谢谢啦!"

What does he say? :P

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

My version Here no restart required

Share this post


Link to post
Share on other sites

"太有帮助了,谢谢啦!"

What does he say? :P

AlmarM

this is chinese .

Share this post


Link to post
Share on other sites

Ahhhhhhhh

That exlpains alot :P

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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
Sign in to follow this  
Followers 0