Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
normalize mac address from scapy
Browse files Browse the repository at this point in the history
  • Loading branch information
markushuber committed Aug 29, 2019
1 parent 92fb593 commit 0d2b46f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion roles/arp/files/apate/lib/apate_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,14 @@ def check_device_disabled(self, mac):
"""
# True if devices is disabled
# return self.redis.get(self._get_device_name(mac, network or self.network, enabled=False)) is not None
return self.redis.sismember(self.get_excluded_key(), mac)
return self.redis.sismember(self.get_excluded_key(), str(mac).lower())

def _toggle_device(self, mac, ip, network, enabled):
# add new device first and delete old device afterwards
# this is done to avoid race conditions
# self.add_device(mac, self.get_device_ip(mac, network, enabled=not enabled), network, enabled=enabled, force=True)
# self.remove_device(mac, network, enabled=not enabled)
mac = str(mac).lower()
if not enabled:
self.redis.sadd(self.get_excluded_key(), mac)
else:
Expand Down
6 changes: 4 additions & 2 deletions roles/fingerprinting/files/registrar/lib/misc_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ def run(self):
if devices:
ans, unans = arping(devices, iface=None, verbose=0)
for device in ans:
if check_preconditions(device[1][ARP].psrc, device[1][ARP].hwsrc):
insert_or_update_fingerprint(self.conn, ip=device[1][ARP].psrc, mac=device[1][ARP].hwsrc)
ip_addr = device[1][ARP].psrc
mac_addr = str(device[1][ARP].hwsrc).lower()
if check_preconditions(ip_addr, mac_addr):
insert_or_update_fingerprint(self.conn, ip=ip_addr, mac=mac_addr)

self.logger.info("checked no mode devices: " + str(devices))

Expand Down

0 comments on commit 0d2b46f

Please sign in to comment.