#3445·bbot

ClosestHostEvent assigns the inherited port, then discards it

Author: TsybonCreated Sep 18, 2026Updated Sep 18, 2026

bbot/core/event/base.py, ClosestHostEvent.__init__:

python
if parent.host:
    self.data["host"] = str(parent.host)
    self._port = parent.port
    # we do this to refresh the hash
    self.data = self.data      # re-derives everything from data; _port is lost
    break

The data setter re-parses the event from data, which holds no port, so the assignment on the line above never survives.

Reproduction: a FINDING whose parent is OPEN_TCP_PORT("8.8.8.8:53"). parent.port is 53; the resulting finding.port is None.

Swapping the two lines — refresh the hash first, then assign _port — looks like the fix. Worth noting in the docstring either way that the inheritance only runs for events that declare no host of their own.

Source: blacklanternsecurity/bbot