SoulA Posted June 25, 2008 Share Posted June 25, 2008 (edited) I decided to write a program to change a computer's mac address and I wanted to do it as a console application. I'm currently at the point where it outputs a list of network adapters installed on the computer in a list and the user then needs to respond. How do I get that response? I looked at ConsoleRead() but it doesn't seem to be what I am looking for. This is what I have so far... #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}") $netAdapterSet = $objWMIService.ExecQuery("select * from Win32_NetworkAdapter") $ai = 1 For $netAdapter in $netAdapterSet $ai = $ai + 1 Next Dim $a[$ai][2] $a[0][0] = 1 $i = 0 $i1 = 1 ConsoleWrite("0. To Exit" & @CRLF) For $netAdapter in $netAdapterSet If $netAdapter.PhysicalAdapter == -1 AND $netAdapter.MACAddress <> "" AND StringRegExp($netAdapter.MACAddress, '\A 00:50') <> 1 Then ConsoleWrite($a[$i][0] & ". " & $netAdapter.Name & @CRLF) $a[$i][1] = $netAdapter.Index $i = $i + 1 $i1 = $i1 + 1 $a[$i][0] = $i1 EndIf Next ConsoleWrite("Please Choose the adapter you want to change: ") ;this is where I am stuck There are some other bugs but before I spend the time to fix those I need to know if this is possible or if I should bite the bullet and switch to GUI. Edited June 25, 2008 by SoulA Link to comment Share on other sites More sharing options...
rasim Posted June 25, 2008 Share Posted June 25, 2008 SoulAI decided to write a program to change a computer's mac addressSorry, but you do not can to change the MAC address, because is physical address. Link to comment Share on other sites More sharing options...
zorphnog Posted June 25, 2008 Share Posted June 25, 2008 SoulASorry, but you do not can to change the MAC address, because is physical address.You can spoof MAC addresses of physical adapters, and change them for virtual adapters. Anyway, the question isn't even about whether you can change MAC addresses, but how to get input from a console.I don't believe that you can read from an active console window. You can try messing around with stdin and stdout functions, but I don't think what you are trying to do is supported by AutoIt. Link to comment Share on other sites More sharing options...
DMEE Posted June 25, 2008 Share Posted June 25, 2008 Actually you cannot change the physical MAC address as burned-in at the factory, however under Windows, the MAC address is stored in a registry key. The location of this key is changed often and therefore utilities are written to change the value of this key. MacShift is a simple utility: http://devices.natetrue.com/macshift/ and can be called by the command lineTo answer the question on where you are stuck:I guess you need the InputBox. In the beginning there was nothing and then even that exploded - anonymous Link to comment Share on other sites More sharing options...
SoulA Posted June 25, 2008 Author Share Posted June 25, 2008 Yeah obviously that part of the code isn't written yet but the program would continue to modify the registry key and enable and disable that particular network adapter. It would also return your mac back to the original as well. Guess I'll make it a gui. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now