Skip to content

Commit

Permalink
Merge pull request #1454 from p-l-/fix-empty-ports
Browse files Browse the repository at this point in the history
DB/Active: fix rec insertion with no ports
  • Loading branch information
p-l- committed Nov 1, 2022
2 parents db23fca + f71e470 commit 82c0d5e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ivre/active/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,10 @@ def gen_auto_tags(
host["extraports"][status].setdefault("reasons", {})[reason] = (
host["extraports"][status].get("reasons", {}).get(reason, 0) + count
)
host["ports"] = [
port for port in host["ports"] if port.get("state_state") != status
]
if host.get("ports"):
host["ports"] = [
port for port in host["ports"] if port.get("state_state") != status
]
# 2. ... Else, let's see if we should remove some ports in
# `status`.
elif (
Expand All @@ -804,9 +805,10 @@ def gen_auto_tags(
)
for reason, count in reasons.items():
host["extraports"][status].setdefault("reasons", {})[reason] = count
host["ports"] = [
port for port in host["ports"] if port.get("state_state") != status
]
if host.get("ports"):
host["ports"] = [
port for port in host["ports"] if port.get("state_state") != status
]


def set_auto_tags(host: NmapHost, update_openports: bool = True) -> None:
Expand Down

0 comments on commit 82c0d5e

Please sign in to comment.