[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:
parent
0bad4f05ae
commit
a94cd416b7
1 changed files with 2 additions and 1 deletions
|
@ -69,12 +69,13 @@ blacklist_key = [
|
||||||
]
|
]
|
||||||
|
|
||||||
def mac_from_ip(ip):
|
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
|
cmd = '/usr/sbin/arp -na %s' % ip
|
||||||
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
||||||
output, errors = p.communicate()
|
output, errors = p.communicate()
|
||||||
if output is not None :
|
if output is not None :
|
||||||
mac_addr = output.split()[3]
|
mac_addr = output.split()[3]
|
||||||
return mac_addr
|
return mac_addr.strip()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue