nacker icon indicating copy to clipboard operation
nacker copied to clipboard

Sorting lambda functions crash

Open altf4 opened this issue 11 years ago • 1 comments

The sorting functions at lines 112 and 113 fail for me, with a stack trace as follows:

Sorting hosts to targeting printers first, and laptops last
Traceback (most recent call last):
  File "./nacker", line 156, in <module>
    main(sys.argv)
  File "./nacker", line 111, in main
    hosts.sort(key = lambda host: host[1].oui.registration().org in PC_MANUFACTURERS)
  File "./nacker", line 111, in <lambda>
    hosts.sort(key = lambda host: host[1].oui.registration().org in PC_MANUFACTURERS)
  File "/usr/lib/python2.7/dist-packages/netaddr/eui/__init__.py", line 464, in oui
    return OUI(self.value >> 24)
  File "/usr/lib/python2.7/dist-packages/netaddr/eui/__init__.py", line 121, in __init__
    raise NotRegisteredError('OUI %r not registered!' % oui)
netaddr.core.NotRegisteredError: OUI 13164779 not registered!

Relevant code:

    # Sort the MAC addresses based on organization, laptops and workstations
    print('Sorting hosts to targeting printers first, and laptops last')
    hosts.sort(key = lambda host: host[1].oui.registration().org in PC_MANUFACTURERS)
    hosts.sort(key = lambda host: host[1].oui.registration().org in PRINTER_MANUFACTURERS, reverse=True)

(Running from an Ubuntu 14.04 machine.)

altf4 avatar Sep 23 '14 17:09 altf4

Oh, my... Wasn't prepared for people testing this tool yet - it's currently not working but thanks for reporting the bugs. Have updated the readme.

carmaa avatar Sep 24 '14 16:09 carmaa