我们是北京易生康富科贸有限公司,我们有个网站: www.42498.net。希望获得访问我们网站的用户的MAC地址,有那位大侠能帮助解决这个问题,我们愿出其不1000元人民币的酬金,可事先由我们公司给您签订合同。
     联系人:邓先生。QQ :42553776  手机13520818138   (加QQ前写上获得MAC地址)
 

解决方案 »

  1.   

    可以直接获取客户端的IP和MAC地址呀,网上很多代码
      

  2.   

    2楼主的,不要误导人家好不好,IP地址是可以获取,但MAC地址也是随意获取吗?!
    B/S程序不能直接获取MAC地址。
    换一个思路吧。
      

  3.   

    ASP.NET获取MAC地址与IP地址以DNS法较为基本 实用,如下:
      以下是引用片段:
    private void ButtonIP_Click(object sender, System.EventArgs e)   
    { System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;   
    if ( addressList.Length>1)   
    { TextLIP.Text = addressList[0].ToString();   
    TextSIP.Text = addressList[1].ToString();   
    }   
    else   
    {   
    TextLIP.Text = addressList[0].ToString();   
    TextSIP.Text = "没有可用的连接";   
    }   
    }  
      ASP.NET获取MAC地址与IP地址另一要领 如下:
      以下是引用片段:
    using System.Management;   
    string stringMAC = "";   
    string stringIP = "";   
    ManagementClass MC = new ManagementClass "Win32_NetworkAdapterConfiguration");   
    ManagementObjectCollection MOC= MC.GetInstances();   
    foreach(ManagementObject MO in MOC)   
    {   
    if ((bool)MO["IPEnabled"] == true)   
    {   
    stringMAC += MO["MACAddress"].ToString();   
    TextMAC.Text = stringMAC.ToString();   
    string[] IPAddresses = (string[]) MO["IPAddress"];   
    if(IPAddresses.Length > 0)   
    stringIP = IPAddresses[0];   
    TextIP.Text = stringIP.ToString();   
    }   
    }  
    获取客户端本机的IP地址相当简易,要领 如下:
      以下是引用片段:
    using System.Net;   
    TextIP.Text=Page.Request.UserHostAddress;  
      如要获取客户端本机的MAC地址就相对复杂些,得导入调用两个API,用ARP协议获取,但这样只能获取到同网段机器的MAC,对于跨网段的得运用 IP扫描或cmd中nBTstat命令获取MAC地址。也可通过读取系统注册表值或WMI的数据库来获取。各位如有简易可行的好办法请留言告诉我。
      ASP.NET获取MAC地址与IP地址的要领 就向你介绍到这里,是不是对ASP.NET获取MAC地址与IP地址有所了解了呢? 
      

  4.   


        如何取得网卡mac地址,就不得不讲到dos命令:NBTSTAT,下面简单介绍下:
    1. 具体功能   该命令用于显示本地计算机和远程计算机的基于 TCP/IP(NetBT) 协议的 NetBIOS 统计资料、 NetBIOS 名称表和 NetBIOS 名称缓存。 NBTSTAT 可以刷新 NetBIOS 名称缓存和注册的 Windows Internet 名称服务 (WINS) 名称。使用不带参数的 NBTSTAT 显示帮助。 2. 语法详解 nbtstat [-a remotename] [-A IPaddress] [-c] [-n] [-r] [-R] [-RR] [-s] [-S] [Interval] 
    3. 参数说明 -a remotename 显示远程计算机的 NetBIOS 名称表, 其中, remote name 是远程计算机的 NetBIOS 计算机名称。 NetBIOS 名称表是运行在该计算机上的应用程序使用的 NetBIOS 名称列表。 
    -A IPaddress 显示远程计算机的 NetBIOS 名称表, 其名称由远程计算机的 IP 地址指定 ( 以小数点分隔 ) 。 
    -c 显示 NetBIOS 名称缓存内容、 NetBIOS 名称表及其解析的各个地址。 
    -n 显示本地计算机的 NetBIOS 名称表。 Registered 中的状态表明该名称是通过广播或 WINS 服务器注册的。 
    -r 显示 NetBIOS 名称解析统计资料。 在配置为使用 WINS 的 Windows 计算机上,该参数将返回已通过广播和 WINS 解析和注册的名称号码。 
    -R 清除 NetBIOS 名称缓存的内容并从 Lmhosts 文件中重新加载带有 #PRE 标记的项目。 
    -RR 重新释放并刷新通过 WINS 注册的本地计算机的 NetBIOS 名称。 
    -s 显示 NetBIOS 客户和服务器会话,并试图将目标 IP 地址转化为名称。 
    -S 显示 NetBIOS 客户和服务器会话,只通过 IP 地址列出远程计算机。 
      Interval 重新显示选择的统计资料,可以中断每个显示之间的 Interval 中指定的秒数。 按Ctrl+C 停止重新显示统计信息。如果省略该参数, NBTSTAT 将只显示一次当前的配置信息。 我们试下它的功能:在DOS窗口下,输入:nbtstat -a 192.168.168.242
          这里的192.168.168.242是我的本机IP,测试中发现呆会的程序并不能取得非本地的mac地址,也就是说只能取得服务器的网卡mac地址,而不能取得客户端的网卡mac地址,记得以前用一些黑客软件的时候可以办到获取对方的网卡mac地址的,有空研究下。结果如下图:看到网卡的MAC地址了吧!也就是:MAC Address = 00-18-F3-A7-E1-56
    所以在asp.net中我们也是根据这个原理,先取得指定Ip的所有信息后,再用正则取得我们要的mac地址。详细代码请参考下面,代码多有参考网络,为我所用,非我所想。using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;//引入相应的空间信息
    using System.Text.RegularExpressions;
    using System.Diagnostics;public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //此处输入Ip地址,你可以做成接受文本框的值进行查询
            Response.Write(GetCustomerMac("192.168.168.242"));
        }  
        //这里是关键函数了
        public string GetCustomerMac(string IP) 
        { 
          string dirResults=""; 
          ProcessStartInfo psi  = new ProcessStartInfo(); 
          Process proc = new Process(); 
          psi.FileName = "nbtstat"; 
          psi.RedirectStandardInput = false; 
          psi.RedirectStandardOutput = true; 
          psi.Arguments = "-a " + IP; 
          psi.UseShellExecute = false; 
          proc = Process.Start(psi); 
          dirResults = proc.StandardOutput.ReadToEnd(); 
          proc.WaitForExit();
            
          //匹配mac地址
          Match m = Regex.Match(dirResults, "\\w+\\-\\w+\\-\\w+\\-\\w+\\-\\w+\\-\\w\\w");      //若匹配成功则返回mac,否则返回找不到主机信息
          if (m.ToString() != "")
          {
              return m.ToString();
          }
          else
          {
              return "找不到主机信息";
          }          }
    }
      

  5.   

    敢问楼主要人有客户端MAC有点清白吧,呵呵
      

  6.   

    4楼,那是获取本机MAC地址好不好。只要服务器权限放得够宽,想获取本机的任何信息都不难做到。
    楼主的需求肯定是获取客户的MAC地址吧。
      

  7.   

    MAC 那么隐私的东西信息,不应该可以用B/S远程获取的吧。nbtstat之类的命令很会被防火墙堵截的。卡巴、ESET 等等防火墙有隐身模式,别人不能自动探测的。用ActiveX在客户端获取还差不多。
      

  8.   

    在B/S 中能隨便取得 客戶端的硬件信息,那不亂套了。
    那天我上百度,我的硬件信息被它無聲無息的偷走了,天啦,不敢想像它們還會做什么?但是如果用AX,經過我的同意了,那還是有可能的。
      

  9.   

    用ActiveX控件,否则不太可能实现
      

  10.   

    用ActiveX控件的方法,我有,可惜只能获到那些安全级别底的
      

  11.   

    这个不可能远程获取,就是做成控件在本地获取,也要调用API,不同系统的API也不都是一样的,关键问题---权限,除非你能获得访问的本机的Shell。
    正常方法太难了
      

  12.   

    我记得可以用JavaScript select 出来
      

  13.   


    其实最关键的还是用到两个ActiveX:
            <OBJECT id=locator classid=CLSID:76A64158-CB41-11D1-8B02-00600806D9B6 VIEWASTEXT></OBJECT>
            <OBJECT id=foo classid=CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223></OBJECT>
            不过这两个ActiveX都是系统自带,不用去下载或注册。
            接下来的工作就是用脚本和ActiveX交互
     
     
    转自:http://zhupan.javaeye.com/blog/26440
    <HTML><HEAD><TITLE>WMI Scripting HTML</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <SCRIPT language=JScript event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
     document.forms[0].txtMACAddr.value=unescape(MACAddr);
     document.forms[0].txtIPAddr.value=unescape(IPAddr);
     document.forms[0].txtDNSName.value=unescape(sDNSName);
     //document.formbar.submit();
      </SCRIPT><SCRIPT language=JScript event=OnObjectReady(objObject,objAsyncContext) for=foo>
       if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true)
       {
        if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
        MACAddr = objObject.MACAddress;
        if(objObject.IPEnabled && objObject.IPAddress(0) != null && objObject.IPAddress(0) != "undefined")
        IPAddr = objObject.IPAddress(0);
        if(objObject.DNSHostName != null && objObject.DNSHostName != "undefined")
        sDNSName = objObject.DNSHostName;
        }
      </SCRIPT><META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
    <BODY>
    <OBJECT id=locator classid=CLSID:76A64158-CB41-11D1-8B02-00600806D9B6 VIEWASTEXT></OBJECT>
    <OBJECT id=foo classid=CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223></OBJECT>
    <SCRIPT language=JScript>
       var service = locator.ConnectServer();
       var MACAddr ;
       var IPAddr ;
       var DomainAddr;
       var sDNSName;
       service.Security_.ImpersonationLevel=3;
       service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
       </SCRIPT><FORM id="formfoo" name="formbar" action="index.do" method="post"><INPUT value="00-11-11-B4-52-EF"   name="txtMACAddr"> <INPUT value="210.42.38.50"  name="txtIPAddr"> <INPUT value="zhupan" name="txtDNSName"> </FORM></BODY></HTML>
      

  14.   

    我給你出一注意,在網頁上搞一個文本框,讓訪問的人輸入自己的MAC地址,不輸不讓進
      

  15.   

    你做一个函数,当用户打开时,自动把本机中的mac找出来,然后保存在一个隐藏的文本框中,再做一个函数,这个函数大概在1min后执行,这个函数将mac用ajax传回服务器一个页面,然后,插入数据库
      

  16.   


    C#获取本地计算机名,IP,MAC地址using System;
    using System.Drawing;
    using System.Management;
    using System.net;
    using System.Net.Sockets;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace MAC_IP_name
    {
         /// <summary>
         /// Form1 的摘要说明。
         /// </summary>
         public class Form1 : System.Windows.Forms.Form
         {
             private System.Windows.Forms.Label label4;
             private System.Windows.Forms.GrouPBox groupBox1;
             private System.Windows.Forms.TextBox txtMac;
             private System.Windows.Forms.TextBox txtIp;
             private System.Windows.Forms.TextBox txtName;
             private System.Windows.Forms.Label lblMac;
             private System.Windows.Forms.Label lblIp;
             private System.Windows.Forms.Label lblName;
             private System.Windows.Forms.Button button1;
             private System.Windows.Forms.Button button2;
             /// <summary>
             /// 必需的设计器变量。
              /// </summary>
             private System.ComponentModel.Container components = null;         public Form1()
             {
                 //
                 // Windows 窗体设计器支持所必需的
                   //
                 InitializeComponent();             //
                 // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
                   //
             }         /// <summary>
             /// 清理所有正在使用的资源。
              /// </summary>
             protected override void Dispose( bool disposing )
             {
                 if( disposing )
                 {
                     if (components != null) 
                     {
                         components.Dispose();
                     }
                 }
                 base.Dispose( disposing );
             }         #region Windows 窗体设计器生成的代码
              /// <summary>
             /// 设计器支持所需的方法 - 不要使用代码编辑器修改
              /// 此方法的内容。
              /// </summary>
             private void InitializeComponent()
             {
                 this.label4 = new System.Windows.Forms.Label();
                 this.groupBox1 = new System.Windows.Forms.GroupBox();
                 this.button2 = new System.Windows.Forms.Button();
                 this.txtMac = new System.Windows.Forms.TextBox();
                 this.txtIp = new System.Windows.Forms.TextBox();
                 this.txtName = new System.Windows.Forms.TextBox();
                 this.lblMac = new System.Windows.Forms.Label();
                 this.lblIp = new System.Windows.Forms.Label();
                 this.lblName = new System.Windows.Forms.Label();
                 this.button1 = new System.Windows.Forms.Button();
                 this.groupBox1.SuspendLayout();
                 this.SuspendLayout();
                 // 
                 // label4
                 // 
                 this.label4.AutoSize = true;
                 this.label4.Font = new System.Drawing.Font("楷体_GB2312", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.label4.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(128)));
                 this.label4.Location = new System.Drawing.Point(49, 16);
                 this.label4.Name = "label4";
                 this.label4.Size = new System.Drawing.Size(245, 26);
                 this.label4.TabIndex = 7;
                 this.label4.Text = "获取本机计算机名IP与MAC";
                 // 
                 // groupBox1
                 // 
                 this.groupBox1.Controls.Add(this.button2);
                 this.groupBox1.Controls.Add(this.txtMac);
                 this.groupBox1.Controls.Add(this.txtIp);
                 this.groupBox1.Controls.Add(this.txtName);
                 this.groupBox1.Controls.Add(this.lblMac);
                 this.groupBox1.Controls.Add(this.lblIp);
                 this.groupBox1.Controls.Add(this.lblName);
                 this.groupBox1.Controls.Add(this.button1);
                 this.groupBox1.Location = new System.Drawing.Point(16, 56);
                 this.groupBox1.Name = "groupBox1";
                 this.groupBox1.Size = new System.Drawing.Size(320, 208);
                 this.groupBox1.TabIndex = 11;
                 this.groupBox1.TabStop = false;
                 this.groupBox1.Text = "获取区";
                 // 
                 // button2
                 // 
                 this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.button2.Location = new System.Drawing.Point(184, 160);
                 this.button2.Name = "button2";
                 this.button2.Size = new System.Drawing.Size(88, 32);
                 this.button2.TabIndex = 18;
                 this.button2.Text = "退出";
                 this.button2.Click += new System.EventHandler(this.button2_Click);
                 // 
                 // txtMac
                 // 
                 this.txtMac.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
                 this.txtMac.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.txtMac.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
                 this.txtMac.Location = new System.Drawing.Point(128, 110);
                 this.txtMac.Name = "txtMac";
                 this.txtMac.ReadOnly = true;
                 this.txtMac.Size = new System.Drawing.Size(168, 21);
                 this.txtMac.TabIndex = 17;
                 this.txtMac.Text = "";
                 // 
                 // txtIp
                 // 
                 this.txtIp.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
                 this.txtIp.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.txtIp.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
                 this.txtIp.Location = new System.Drawing.Point(128, 70);
                 this.txtIp.Name = "txtIp";
                 this.txtIp.ReadOnly = true;
                 this.txtIp.Size = new System.Drawing.Size(168, 21);
                 this.txtIp.TabIndex = 16;
                 this.txtIp.Text = "";             
      

  17.   


    接上:
    // 
                 // txtName
                 // 
                 this.txtName.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
                 this.txtName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.txtName.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
                 this.txtName.Location = new System.Drawing.Point(128, 30);
                 this.txtName.Name = "txtName";
                 this.txtName.ReadOnly = true;
                 this.txtName.Size = new System.Drawing.Size(168, 21);
                 this.txtName.TabIndex = 15;
                 this.txtName.Text = "";
                 // 
                 // lblMac
                 // 
                 this.lblMac.AutoSize = true;
                 this.lblMac.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.lblMac.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
                 this.lblMac.Location = new System.Drawing.Point(32, 112);
                 this.lblMac.Name = "lblMac";
                 this.lblMac.Size = new System.Drawing.Size(88, 22);
                 this.lblMac.TabIndex = 14;
                 this.lblMac.Text = "MAC地址为:";
                 // 
                 // lblIp
                 // 
                 this.lblIp.AutoSize = true;
                 this.lblIp.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.lblIp.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
                 this.lblIp.Location = new System.Drawing.Point(40, 72);
                 this.lblIp.Name = "lblIp";
                 this.lblIp.Size = new System.Drawing.Size(80, 22);
                 this.lblIp.TabIndex = 13;
                 this.lblIp.Text = "IP地址为:";
                 // 
                 // lblName
                 // 
                 this.lblName.AutoSize = true;
                 this.lblName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.lblName.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(64)));
                 this.lblName.Location = new System.Drawing.Point(24, 32);
                 this.lblName.Name = "lblName";
                 this.lblName.Size = new System.Drawing.Size(97, 22);
                 this.lblName.TabIndex = 12;
                 this.lblName.Text = "计算机名为:";
                 // 
                 // button1
                 // 
                 this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
                 this.button1.Location = new System.Drawing.Point(48, 160);
                 this.button1.Name = "button1";
                 this.button1.Size = new System.Drawing.Size(88, 32);
                 this.button1.TabIndex = 11;
                 this.button1.Text = "点击获取";
                 this.button1.Click += new System.EventHandler(this.button1_Click_1);
                 // 
                 // Form1
                 // 
                 this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
                 this.ClientSize = new System.Drawing.Size(352, 285);
                 this.Controls.Add(this.groupBox1);
                 this.Controls.Add(this.label4);
                 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
                 this.MaximizeBox = false;
                 this.Name = "Form1";
                 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                 this.Text = "IP,计算机名,MAC查询";
                 this.groupBox1.ResumeLayout(false);
                 this.ResumeLayout(false);
             }
             #endregion
             /// <summary>
             /// 应用程序的主入口点。
              /// </summary>
             [STAThread]
             static void Main() 
             {
                 Application.Run(new Form1());
             }         private void button1_Click_1(object sender, System.EventArgs e)
             {
                 string s="",mac=""; 
                 //
                 //name
                 //
                 string hostInfo = Dns.GetHostName();                         //
                 //IP
                 System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;  
                 for (int i = 0; i < addressList.Length; i ++) 
                 { 
                     s += addressList[i].ToString(); 
                 } 
                 //
                 //mac
                 //
                 ManagementClass mc;
                 mc=new ManagementClass("Win32_NetworkAdapterConfiguration");
                 ManagementObjectCollection moc=mc.GetInstances();
                 foreach(ManagementObject mo in moc)
                 {
                     if(mo["IPEnabled"].ToString()=="True")
                         mac=mo["MacAddress"].ToString();                    
                 }             txtName.Text=hostInfo;
                 txtIp.Text=s;
                 txtMac.Text=mac;             button1.Enabled=false;
                 button2.Focus();
             }         private void button2_Click(object sender, System.EventArgs e)
             {
                 Application.Exit();
             }
         }
    }声明:此代码系转载楼主,我的要求好低哦,你给我1000个技术分吧
      

  18.   

    除了activeX没有其它方法
    b/s模式下不可能有那么大权限获取硬件信息的
      

  19.   

    感觉不用控件不可能实现,就像四楼说的,要想查询本机MAC地址必须要执行命令,要执行就必须要有用户同意,而且必须有程序入口。如果想不经同意就随意执行了客户端的东西,那谁还敢上网。
    IP地址则不同,在互联网通讯的时候必须要知道IP地址,IP地址随数据一起走的,想捕获的时候就捕获了,MAC没跟着走,想要的话没地方捕获,需要自己来取,你来取你就要告诉我,否则我不给你。
      

  20.   

    4楼的大哥你完全被忽了,他就想一点一点套代码!刚开始说ActiveX办法他有,但是安全级别太低,等你把代码贴完后,他就转口说:实在不行,也值得一试(给自己台阶下的托词)!
      

  21.   

    风语者..兄台.哥们挺你.不过貌似楼主1000RMB不想出...
      

  22.   

    看来只能用插件 不过没事要MAC位址做什么?一般不是都只要IP加COOKIE 就行了
      

  23.   

    直接做个客户端的应用程序去获取,获取了传回服务器,你在网页上放上这个应用程序的链接就可以,这样可以提示用户下载或打开,也不会有安全级别的限制。不然你就得用ActiveX来做了,总之建议走让客户自己去获取MAC地址的路线。
      

  24.   

    除了在客户端安装插件,否则是绝对不可能通过浏览器就能获取MAC的,那就不叫B/s了楼主 还是省省这条心