[portail_captif] Hack pour monitorer les portail captif depuis lui même

En effet, sa propre ip n'apparaît pas dans sa table arp
This commit is contained in:
Valentin Samir 2013-06-16 22:32:36 +02:00
parent 0bad4f05ae
commit a94cd416b7

View file

@ -69,12 +69,13 @@ blacklist_key = [
]
def mac_from_ip(ip):
if ip == "10.51.0.10": return u"02:72:6f:75:74:07"
cmd = '/usr/sbin/arp -na %s' % ip
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
output, errors = p.communicate()
if output is not None :
mac_addr = output.split()[3]
return mac_addr
return mac_addr.strip()
else:
return None