Thread: Macro help
View Single Post
Old July 2nd, 2009, 10:54 PM   #5 (permalink)
wormboy
Post Whore
 
wormboy's Avatar
 
Join Date: Nov 2008
Posts: 412
usage: cscript spoof.vbs <spoof address>

Code:
Const HIVE = &H80000002
Const networkSubKey = "NetworkAddress"
'Const newAddress = "000C41ADD697"

Dim regObj, arrSubKeys, str, subKeyPath,  newAddress

'newAddress = InputBox("addr:", "Spoof MAC address")
If WScript.Arguments.Count = 0 Then
Wscript.Echo "usage: cscript spoof.vbs <spoof address>"
WScript.Quit
Else
newAddress = Wscript.Arguments.Item(0)
End If

Set regObj = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
subKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010"

Function RegistryKeyExists(LNGHKEY, strKey, subKey)
RegistryKeyExists = False
regObj.EnumValues LNGHKEY, strKey, arrSubKeys
If Not IsNull(arrSubKeys) Then
For Each str In arrSubKeys
If lcase(str) = lcase(subKey) Then
RegistryKeyExists = True
Exit Function
End If
Next
End If
End Function

If RegistryKeyExists(HIVE, subKeyPath, networkSubKey) = True Then
If (regObj.SetStringValue(HIVE, subKeyPath, networkSubKey, newAddress) <> 0) And (Err.Number <> 0) Then
Wscript.Echo "SetStringValue error: " & Err.Number
End If
Else
If (regObj.CreateKey(HIVE, subKeyPath) = 0) And (Err.Number = 0) Then
If (regObj.SetStringValue(HIVE, subKeyPath, networkSubKey, newAddress) <> 0) And (Err.Number <> 0) Then
Wscript.Echo "SetStringValue error: " & Err.Number
End If
Else
Wscript.Echo "CreateKey error: " & Err.Number
End If
End If
take note of subKeyPath variable

[edit]
don't add "-", " ", or "." to the address

[edit]
the subkey 0010 of {4D36E972-E325-11CE-BFC1-08002bE10318} pertains to my Wireless-G notebook adapter. forgot to mention i was using my own stuff as an example. sorry about that.
__________________
"Blow it out your ass U pathetic piece of shit." -- blah2

Last edited by wormboy; July 3rd, 2009 at 01:19 AM..
wormboy is offline   Reply With Quote