KCarretto / Arsenal

Extensible Red Team Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MAC Conflicts

KCarretto opened this issue · comments

If two Targets have one mac address that is the same, the Mongo index does not allow that target to be saved as each mac address in the array must be unique. This causes the creation of a new target to throw a NotUniqueError. At the same time, the Target.get_by_macs function will compare to see if the provided list of macaddresses is a subset of any document's macaddresses. This means that it compares all, and not each individually.

Reproduce:
DESKTOP = ['AA:AA:AA:AA:AA:AA', 'BB:BB:BB:BB:BB:BB', '00:50:56:C0:00:01', '00:50:56:C0:00:08', '']
LAPTOP = ['CC:CC:CC:CC:CC:CC', 'DD:DD:DD:DD:DD:DD', '00:50:56:C0:00:01', '00:50:56:C0:00:08', '']

all(m in DESKTOP for m in LAPTOP) is False, which is how the Target.get_by_macs function operates
any(m in DESKTOP for m in LAPTOP) is True, which is how the Mongo index unique comparison operates.

The (first example) all behavior is desired.