Get a Users MAC addr without ActiveX

I have searched the threads on thsi forum and found a way to retrieve a user on your site's MAC addr via an ActiveX control.
However, an ActiveX control does no good to someone using a Mozilla browser.

Now I have seen sites that will tell you things like your IP, DNS name, and MAC without having to accept an ActiveX, and will perform the same in Firefox.
Now the reason I am asking this, is I am developing a text based RPG game, and as we all know, people/kids can be a problem.
Sure I could ban them by IP or Email, but in todays world, and IP change is simple, and emails are free.

So, Does anyone know how to do this?
Who is Participating?
But you just answered your own question...this was for connecting directly to a specific network.  ie, a local network.  As the examples I've pointed out show, this will work because the router is the next hop, so it can detect your mac address.  Now, if I connected to the same script from my home in Pittsburgh, Pennsylvania, it would not be able to do this.  I assure you, with the current version of the IP standard (IPv4), this is quite impossible to do on an internet level without client-side intervention.  I wish I could give you another answer, but I can't.

In essence, I can easily check and view the MAC addresses on all of the computers on my home network.  With my configuration, I can even see the mac address of Verizon's router that I connect through to them.  However, I can't see the mac address of a machine beyond that unless it tells it to me by some method.  IP addressing was developed because the mac address doesn't follow the packet to the destination.  If it did, there'd be no need to IP addresses as MAC addresses can actually be far more unique and which is why IPv6 uses a convention similar to a MAC address for it's IP resolution.  
This may work as a solution, independent of the browser being used - however, you'll need to be running an NT server to do this.


     strIP = Request.ServerVariables("REMOTE_ADDR")
     strMac = GetMACAddress(strIP)
     strHost = Request.ServerVariables("REMOTE_HOST")

 Function GetMACAddress(strIP)
   set net = Server.CreateObject("")
   set sh = Server.CreateObject("") "%comspec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true
   set sh = nothing
   set fso = createobject("scripting.filesystemobject")
   set ts = fso.opentextfile("c:\" & strIP & ".txt")
   macaddress = null
   do while not ts.AtEndOfStream
     data = ucase(trim(ts.readline))
     if instr(data,"MAC ADDRESS") then
       macaddress = trim(split(data,"=")(1))
       exit do
     end if
   set ts = nothing
   fso.deletefile "c:\" & strIP & ".txt"
   set fso = nothing
   GetMACAddress = macaddress
 End Function    

<TITLE>Say Hello To the MAC MAN</TITLE>
<%Response.Write("Your IP is : " & strIP & "<br>" & vbcrlf)%>
<%Response.Write("Your MAC is : " & strMac & vbcrlf)%>

I sourced this from the following page:
KellyCraigAuthor Commented:
Thank you so much for your response, however, I did see that post and I am running a UNIX/LINUX server.
I had to move froma  windows server because it didnt handle my authenticate sessions very well.

Is there a way to do it via PHP, Javascript, or any other scripting used on a unix/linux server?

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Unfortunatley, I must be the bearer of bad news, while recently researching this topic myself, it is not possible without the aid of external software of a users computer to determine the MAC address (via the internet).

The mac address is only accessible to web servers when NetBios is available (Port 139) so this example will work in most situations on LAN's however most (generally all) firewalls or routers will block netbios.

I have heard however of some software that is able to obtain the mac address using TCP packet capturing but alas I have no concrete evidence of this.  If someone else can proove me wrong, that would be wonderful news, but do not hold out too much hope.

This is not entirely true.  You CAN do it in PHP because it CAN be done.  The problem is that it's unlikely that the MAC address you retrieve will be that of the actual network connection on the other end.  However, there may be an easy way to see the mac address coming in with a given IP address.  Log onto your server via telnet/ssh and run 'arp' and see how many entries it has.  
KellyCraigAuthor Commented:
Yea, about that, I dont have ssh abilities to my server.

No telnet either, I'm guessing?
KellyCraigAuthor Commented:
No, most unfortunately not, besides, I am looking for this to be a more automated proceedure, rather than manual.
I want to be able to record a logged in users MAC, so that banning them becomes mroe effective than refreshing your IP and getting a new email.

Well, the automated procedure would follow, was trying to determine if it would work manually first.  But, as I said before, logging the user's mac is almost impossible, this would be the mac of the last hop of the packet.  In some situations, this would be your firewall, which would make it completely useless.  For it to be useful at all would require a common, though improper configuration of the network hierarchy at your service provider.  Even if you somehow managed to get the users mac address (could probably be done via java), the server wouldn't see this mac address anyhow, so you'd have to block it client-side...but, they could just disable java and bypass it.  But, if you made the site require java to work, then you could enforce it...but it would limit the people whom could use your site to those who have the java plugin installed and enabled.
KellyCraigAuthor Commented:
As I said, you all seem to be taking the hard route around this.
The closest thing I saw was with the ASP, but I run on a Linux Server.
I have googlead all around, and cannot find an example of it, but I know standard PHP and or Javascripting can grab someone's MAC address.

There is an outlying chance that javascript can...PHP and ASP cannot.  Though they may be used to generate the javascript that does it, they themselves can't.  Either Java, or if you want to limit it to IE on Windows, ActiveX are about the only sure ways to do this.  You say you've seen a site that does it.  Tell me what that site is and I'll tell you how they're doing it.  

The best explanation I can see of why can be found here:
An IP address stays the same for a machine, for all websites it visits until that IP address is renewed.

On a request to your Linux server by a client, perhaps you could use a web service to an NT server to implement the example I've offered?

Every time you get a request from a client, send the client's IP to the NT server, and the NT server checks the MAC address for you and sends it back as text to the Linux server. It's a lot of server load, but it would work, assuming the NT solution works. The server load could be perhaps lessened by only checking the MAC address at certain times, perhaps once per login (which you should only need, because you can use sessions to keep that specific user active as long as needed).
Doesn't NT get the mac from the IP via would this work across the internet?
KellyCraigAuthor Commented:
Ok, so it looks like the site was not using PHP, but in fact had a subsystem in the PHP calling a CGI script to get the client MAC address.
The webmaster told me it was universal as in all web browsers and all OS's, but woudl not tell me how the CGI did it.

Does this jog someones mind?
KellyCraigAuthor Commented:
btw, where I saw this was at CU (Colorado University).
When you joined wireless, you would give it your username/password and the web page would get your mac addr, add it to the dhcpd.conf file and ask you to re-connect to the wireless network.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.