2

I am beginner in programming. I am creating study project in Djnago-Python. I want to store MAC address of user who accessing my website (Just for better service purpose). How I get that using Django-Python or any other scripting language?

I tried to many things which I get from Stack Overflow. Those all just returns host's MAC address. I checked this via creating intranet environment and accessed my site from another device. So, how can I get the MAC address of device from which the site is accessing.?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Bhuvan Gandhi
  • 167
  • 4
  • 10
  • The MAC address is not communicated from the client to your server. The only place where you maybe could get the MAC address of a client is if the client is attached to the same local network as your server, in other cases the you can only observe the MAC address of your host or the IP router that routes messages from the client. - but neither python nor django will provide an interface for doing that, you'll would likely need to query the ARP cache in your OS and correlate that information yourself. Instead, get the IP address of the client. – nos Oct 10 '18 at 10:11
  • Okay, thanks for your reply... you mentioned there something about query the ARP cache in OS... What does that mean? Can you explain this? – Bhuvan Gandhi Oct 11 '18 at 07:51
  • See this answer: https://superuser.com/a/1246597/4595 – nos Oct 11 '18 at 08:02

1 Answers1

3

That is only possible on the side of the users PC.You can not get the MAC address from a script running on the host (where it would run if you use django).

That means, you have to execute a script in the browser of your users. Javascript is an option for that. A similar question is here: MAC addresses in JavaScript

rbf
  • 541
  • 4
  • 16