Get MAC in Django / python from a Device that accesses a certain URL

0

I want to get the mac from a device when the device runs or accesses the URL: 127.0.0.1/Response, which is defined in URLs such as: url (r '^ answer $', app.views.resviewViewiew, name = 'Reply'),

from uuid import getnode as get_mac

def respuestaView(request):
    mac = get_mac()
        mac = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2))

mac returns the MAC of the device where the application is running BUT not the mac of the device who accessed the URL: 127.0.0.1/Response

    
asked by Noel L 15.06.2018 в 21:10
source

1 answer

0

No. What you're trying to do, you can not. Point.

The only alternative is that the device that originates the call HTTP passes it to you explicitly in some parameter.

This is the simplified NETWORK STACK:

CAPA APLICACIÓN (HTTP)
CAPA TCP
CAPA IP <--------------- OJO CON ESTA CAPA
CAPA DE ENLACE (MAC)
CAPA FÍSICA

In a WEB application, you can go to the IP layer, but not below.

When your package left your LAN and entered the CAPA IP, (that is, when a router directed your package to other networks) the information of the original% MAC ADDRESS is lost forever.

    
answered by 15.06.2018 в 21:25