Wus Posted February 5, 2006 Posted February 5, 2006 At my college they prohibit the use to bittorrent programs and they have smart switches that 'quarentine' people that they detect using torrent programs. Well I found that they quarentined by mac address so naturally I automated the task of getting un-quarentined.I figured out how to enable/disable a network connection (this proved to be pretty difficult with no wmi method)This function came from a vbs script found at http://channel9.msdn.com/ShowPost.aspx?PostID=158556more can be found athttp://groups.google.com/group/microsoft.p...b3fab1141c6c93eThe first param tells whether you want to disable or reenable the connectionThe 2nd param is the name of the network connection (default to 'Local Area Connection')The 3rd param i put in to account for versions of windows other than xp. The folder isnt called 'Network Connection' on all versions fo windows so this might be modfied to 'Networking and Dialup connections' or whater it was callled in older versions of windows. I have not tested this on any other version of windows.expandcollapse popupFunc NicToggle($Toggle, $sConnectionName = "Local Area Connection", $sNetworkFolder = "Network Connections") $ssfCONTROLS = 3 $sEnableVerb = "En&able" $sDisableVerb = "Disa&ble" $shellApp = ObjCreate("shell.application") $oControlPanel = $shellApp.Namespace ($ssfCONTROLS) $oNetConnections = "nothing" For $folderitem In $oControlPanel.items If $folderitem.name = $sNetworkFolder Then $oNetConnections = $folderitem.getfolder ExitLoop EndIf Next If $oNetConnections = "nothing" Then MsgBox(48, "Error", "Couldn't find " & $sNetworkFolder & " folder") Exit EndIf $oLanConnection = "nothing" For $folderitem In $oNetConnections.items If StringLower($folderitem.name) = StringLower($sConnectionName) Then $oLanConnection = $folderitem ExitLoop EndIf Next If $oLanConnection = "nothing" Then MsgBox(48, "Error", "Couldn't find '" & $sConnectionName & "' item") Exit EndIf $bEnabled = True $oEnableVerb = "nothing" $oDisableVerb = "nothing" $s = "Verbs: " & @CRLF For $verb In $oLanConnection.verbs $s = $s & @CRLF & $verb.name ;enables If $verb.name = $sEnableVerb And $Toggle = 1 Then $oEnableVerb = $verb $oEnableVerb.DoIt ExitLoop ;disables ElseIf $verb.name = $sDisableVerb And $Toggle = 0 Then $oDisableVerb = $verb $oDisableVerb.DoIt ExitLoop Else MsgBox(48, "Error", "Tried to disable when already disabled" & @CRLF & "or enable when already enabled") Exit EndIf Next Sleep(1000) EndFunc ;==>NicToggleThis function generates a sorta-kinda random mac address. It could be much more random, but it was good enough for me. The first two are zero because it was easier to do that than to check for even or odd leading bytes (some rules for mac addressing). Func RandomMAC() Local $newMAC = "00" For $i = 1 To 5 $newMAC &= Hex( Random(0, 255, 1), 2) Next Return $newMAC EndFunc ;==>RandomMACThis code finds the hwid for the connected connection, this combined with some reg searching makes it possible to find the relavent regkey that the mac address can be changed in. It requires two includes (not really sure if it needs the contstants).#include <Constants.au3>#include <array.au3>$stdout = Run(@ComSpec & " /c net config rdr", '', @SW_HIDE, 2) Global $all While 1 $data = StdoutRead($stdout) If @error Then ExitLoop If $data Then $all &= $data Else Sleep(10) EndIf WEnd $DataArray = StringSplit($all, @CRLF) $id = StringTrimLeft( StringTrimRight($DataArray[13], 15), 13)Non of the code is that pretty, but some of it I thought might be worth posting. I may try to clean the functions up later.Attached is the actual script I used to disable->generate a mac->change the mac->enablechangeMAC.au3
TomTheGeek Posted February 7, 2006 Posted February 7, 2006 Very cool. I think I may alter this so I can change my MAC to a specific MAC as well as a random MAC. Also I would want a way to set the MAC back to the original. I think it would be more realistic to build a list of manufacturers MAC addresses and use those for the first part. That way it would at least look like a real NIC if a person was looking at it. I'll post any changes I make. -------------
jftuga Posted February 7, 2006 Posted February 7, 2006 So what college did you say that you attended? -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile
Wus Posted February 7, 2006 Author Posted February 7, 2006 (edited) Hood college in MDhttp://maps.google.com/?ll=39.422437,-77.4....032223,0.05888@Tomthegeeyeh i found out about that manufacturer thing and it could be implemented along with the reset to default and set to specifiedI just wanted it to work for my purposes first. I can work on that when i get a chance.BTW can anyone tell me if it works on older versions of windows if the correct params are specified. Edited February 7, 2006 by Wus
dv8 Posted March 12, 2006 Posted March 12, 2006 (edited) WUS, this script is great!!! Thank you for sharing it. I have a broadband modem here at home, which is configured by my provider to connect to my home PC's NIC useing it's MAC address. I also have a laptop from work and sometimes i need to connect it to internet at home.So I modified your script a bit, to be able to enter desired MAC manualy. (see the attachment)It needs some more modifications (for example checking if entered value is a valid MAC address), but don't have much time and it works for me as it is. 10x again for shareing it !EDIT: Here is a great freeware (with C++ source code included) for Win2000 and WinXP which i use for the purpose, but it would be nice to see similar freeware made with AutoIt. ModifiedChangeMAC.au3 Edited March 13, 2006 by dv8 Free Remote Desktop Software For Windows
ConsultingJoe Posted March 12, 2006 Posted March 12, 2006 hey, i like the idea. I want to do this to but I want to do it to my wifi adapter. do I just change the name to "intel" because thats the name of my adapter??? thanks Check out ConsultingJoe.com
dv8 Posted March 13, 2006 Posted March 13, 2006 hey, i like the idea. I want to do this to but I want to do it to my wifi adapter. do I just change the name to "intel" because thats the name of my adapter???thankszerocool60544, if you use the script it should change the addres of the active adapter, i think. And it is tested only on Win XP.If you use the program from the link i put in my last post, then you should first chose the adapter and then input the new MAC.NOTE, that this program to work your Windows version should be XP or 2003. And there are some adapters whose MAC address can't be changed. Free Remote Desktop Software For Windows
ConsultingJoe Posted March 13, 2006 Posted March 13, 2006 zerocool60544, if you use the script it should change the addres of the active adapter, i think. And it is tested only on Win XP.If you use the program from the link i put in my last post, then you should first chose the adapter and then input the new MAC.NOTE, that this program to work your Windows version should be XP or 2003. And there are some adapters whose MAC address can't be changed.I tried the script at my school, jjc, and they block that stuff, I got an error from the pc, insafitiant priviliagesis there away around that Check out ConsultingJoe.com
dv8 Posted March 14, 2006 Posted March 14, 2006 I tried the script at my school, jjc, and they block that stuff, I got an error from the pc, insafitiant priviliagesis there away around that I don't think so. This script changes some registry keys, so you must have admin rights to execute it correctly. Free Remote Desktop Software For Windows
ConsultingJoe Posted March 14, 2006 Posted March 14, 2006 ok, i figured, thanks Check out ConsultingJoe.com
MrVining Posted March 29, 2006 Posted March 29, 2006 Okay, I'm new to "Windows". I don't have a lot of time right now (who does ;-p) to learn a new scripting language (last time I scripted was in 1995 using apple script). This script looks VERY close to what I am looking for, and if I have to write the script myself this is where I will start. Goal: Cycel through my networks. I have 3 network cards installed. They are connected to 3 differant networks. More to come soon. I need a script that will check to see what network connection is active. Disable that network connection. Then enable the next one. A,B,C,A,B,C... and so on. Pertanent Info: OS- Windows XP Pro Network connection names- Local Area A Local Area B Local Area C Reward: I am not some big company with money to through around; I'm just a home user. But if someone comes up with a functional script. I would give them something for thair time. I would like to PayPal them 20-30 bucks, so they can buy a DVD or something as a thank you. Any questions I check my eMail often: ebridenbecker@yahoo.com
schnikies79 Posted April 24, 2006 Posted April 24, 2006 I made a script similar to this with Macro Scheduler. It's kinda exspensive to get the compiler so I searched around and found auto-it. Great program. Anyway, my school has a 5gb/week bandwidth limit. When you connect an unknown computer to the network you have to register it via your school login/password. After a while I figured out they were measuring how much bandwidth you used via your mac address. There is no limit to how many computers you can register. I use bandwidth monitor pro to monitor the total upload+download /week and then execute the script at 4.5gb. I have a batch file stored locally with 10 possible mac addresses, which it will it will roll though. After the 10 has been registered, it can keep going on on its own. I don't have a lot of experience with auto-it yet so most of the work is done in batch. Copying and pasting from log files is done via auto-it. Right now you have to put in a load of info into the batch file such as hardware id, hardware # for smac-cl, possible mac address, and for the first time you run it, the current mac. It doesnt sound bad but it's a lot of command line work to get some of that info. My goal is to have a simple config file that auto-it will read from, but that might be a while. I'm currently using the following utilities to do the work: ipconfig smac-cl (cmd line utility for changing the mac address) devcon (microsoft utility to control hardware from cmd prompt, for disabling/renabling the network adapter) I had to buy smac-cl. Macshift is a freebie program but dosen't work on Intel adapters for some reason. If anyone cares to see all the code work, let me know and Ill clean it up and share it.
rbhkamal Posted November 30, 2006 Posted November 30, 2006 Nice script..I will try it soon. I allways thought that the MAC address is hard coded in NIC and the only one who can change it is the manufacturer.... RK "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
CyberSlug Posted December 1, 2006 Posted December 1, 2006 (edited) I allways thought that the MAC address is hard coded in NIC and the only one who can change it is the manufacturer....Yes, and No. The operating system can report whatever MAC address you want it to.... In fact, many manufactures have nic drivers that allow you specify a MAC address, as shown in screenshot below. (If you don't override it, the default value hard-coded in the NIC is used as the MAC address.)Interesting read: http://www.klcconsulting.net/Change_MAC_w2k.htm Edited December 1, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
rbhkamal Posted December 1, 2006 Posted December 1, 2006 Nice tool, I heard about MAC spoofing many times but never caught my interest until now. Thanks for the link. RK "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
Jabberwock Posted December 3, 2006 Posted December 3, 2006 I do not suggest using this script until you find or make a backup of those registry keys he does change, because if it runs into an error, there is nothing but a msgbox to tell you so, and thus leaving you without internet until you set it back to normal.
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