c# - how to spoof MAC address via code -
i'm trying spoof mac address of computer executes program. right i'm getting current mac address of machine using 'getmac' command via cmd, want change via 'registrykey' class(windows.system32).
the issue don't know string pass opensubkey method.
for example method read current mac registry key reading:
private string readmac() { registrykey rkey; string mac; rkey = registry.localmachine.opensubkey("system\\currentcontrolset\\control\\class\\{4d36e972-e325-11ce-bfc1-08002be10318}\\0012", true); //--->this string change mac = (string)rkey.getvalue("networkaddress"); rkey.close(); return mac; }
this should point in right direction, you're going have figure out code:
- look in
hkey_local_machine\system\currentcontrolset\services\tcpip\parameters\interfaces\, you'll see few sub keys corresponding interfaces in "network connections" control panel. 1 have valid ip, , others have 0.0.0.0 you'll need pattern matching figure out 1 right one. - get key name interface (it's guid, or @ least looks one), , go
hkey_local_machine\system\currentcontrolset\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}, check each one'snetcfginstanceidvalue (or search) guid of interface.
Comments
Post a Comment