如何通过代码欺骗MAC地址 [英] how to spoof MAC address via code

查看:122
本文介绍了如何通过代码欺骗MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图欺骗执行我的程序的计算机的MAC地址.现在,我通过cmd使用"getmac"命令获取了计算机的当前MAC地址,然后我想通过"RegistryKey"类(windows.system32)对其进行更改.

I'm trying to spoof the MAC address of the computer that executes my program. Right now I'm getting the current MAC address of the machine using the 'getmac' command via cmd, then I want to change it via the 'RegistryKey' class(windows.system32).

问题是我不知道要传递给OpenSubKey方法的字符串.

The issue is that I don't know the string to pass to the OpenSubKey method.

例如,这是使用注册表项读取来读取当前MAC的方法:

For example this is the method to read the current MAC with 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 is the string to change 
        MAC = (string)rkey.GetValue("NetworkAddress");
        rkey.Close();
        return MAC;
    }

推荐答案

这应该为您指明正确的方向,但是您将不得不弄清楚代码:

This should point you in the right direction, but you're going to have to figure out the code:

  1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\中查找,您将在网络连接"控制面板中看到一些与接口相对应的子键.可能只有一个拥有有效的IP,而另一个拥有0.0.0.0.您将需要进行一些模式匹配,以找出哪个是正确的IP.
  2. 获取接口的键名(它是一个GUID,或者至少看起来像一个),然后返回HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}并检查每个人的NetCfgInstanceId值(或搜索)以获取接口的GUID. /li>
  1. look in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\ and you'll see a few sub keys corresponding to the interfaces in the "network connections" control panel. Probably only one will have a valid IP, and the others will have 0.0.0.0 You'll need to do some pattern matching to figure out which one is the right one.
  2. get the key name for the interface (it's a GUID, or at least looks like one), and go back to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} and check each one's NetCfgInstanceId value (or search) for the GUID of the interface.

这篇关于如何通过代码欺骗MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆