views:

1828

answers:

4

Hi

I was asked to write a servlet that collects client's details such as ip, mac address etc.

getting his IP is pretty straight-forward (request.getRemoteAddr()) but I dont find an elegant way to get his MAC address.

seems reasonable that the web server has access to data such as Mac address etc, since it gets the TCP packets and all. does this data registers somewhere? is it accessible?

(I'm working on top of Tomcat6)

+5  A: 

TCP/IP... You can't get the MAC Address, that's a too low layer AFAIK

ktulur
the MAC is available, however, irrelevant since it is most likely not the client's NIC but some the MAC of the closest device to the server.
Tzury Bar Yochay
A: 

I believe that clients need to allow for this to happen in their JVM:

See this thread

tehblanx
i was assuming the client would be a browser?
Steve Claridge
A: 

This isn't possible through the HttpServlet class.

The only way I can think of possibly gettnig a users MAC address is to use Javascript on the client side to retrieve it and then place it in a cookie that your server can then read. But, I don't know if it's possible to get MAC addr using Javascript - would seem like a security risk for a browser to allow you to do this as it's going outside the browser's sandbox but maybe there's some hack around to do it.

Steve Claridge
+7  A: 
atom255
In re-reading other answers I agree that if you get people's computers to give up their internal config you can do better, but I doubt any security model would allow it. Same thing as trying to get someone's internal IP address, the best you can usually do is get the router that's doing address translation.
atom255