Update mikrotikFindIPv6.py

This commit is contained in:
Robert Chacón 2024-01-07 23:48:49 -07:00 committed by GitHub
parent 14075ed763
commit 43fe3c2edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,10 +35,15 @@ def pullMikrotikIPv6():
list_binding6 = api.get_resource('/ipv6/dhcp-server/binding')
entries = list_binding6.get()
for entry in entries:
try:
clientAddressToIPv6[entry['client-address']] = entry['address']
except:
pass
if len(entry['duid']) == 14:
mac = entry['duid'][2:14].upper()
macNew = mac[0:2] + ':' + mac[2:4] + ':' + mac[4:6] + ':' + mac[6:8] + ':' + mac[8:10] + ':' + mac[10:12]
macToIPv6[macNew] = entry['address']
else:
try:
clientAddressToIPv6[entry['client-address']] = entry['address']
except:
pass
list_neighbor6 = api.get_resource('/ipv6/neighbor')
entries = list_neighbor6.get()
for entry in entries: