MCPcopy
hub / github.com/USArmyResearchLab/Dshell / packet_handler

Method packet_handler

dshell/plugins/protocol/ether.py:47–64  ·  view source on GitHub ↗
(self, pkt)

Source from the content-addressed store, hash-verified

45 self.logger.warning("Could not find {} (see README). Will not be able to determine MAC organizations.".format(ouifilepath))
46
47 def packet_handler(self, pkt):
48 if not pkt.smac or not pkt.dmac:
49 return
50 smac_prefix = pkt.smac[:8].upper()
51 smac_org = self.oui_map.get(smac_prefix, '???')
52 dmac_prefix = pkt.dmac[:8].upper()
53 dmac_org = self.oui_map.get(dmac_prefix, '???')
54
55 # Filter out any packets that do not match organization filter
56 if self.org:
57 if self.org_exclusive and (smac_org in self.org or dmac_org in self.org):
58 return
59 elif not self.org_exclusive and not (smac_org in self.org or dmac_org in self.org):
60 return
61
62 if not self.quiet:
63 self.write("", smac_org=smac_org, dmac_org=dmac_org, **pkt.info())
64 return pkt
65
66
67if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected