Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend nmap capability in discovery node #1090

Merged
merged 4 commits into from
Mar 4, 2025
Merged

Conversation

noursaidi
Copy link
Collaborator

Sample payload

{
  "generation": "2025-02-13T14:29:22Z",
  "family": "ether",
  "addr": "192.168.12.1",
  "version": "1.5.1",
  "timestamp": "2025-02-13T14:29:52Z",
  "refs": {
    "20": {
      "aux": {
        "port_number": "20",
        "sort_index": 20,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "21": {
      "aux": {
        "port_number": "21",
        "sort_index": 21,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "22": {
      "aux": {
        "port_number": "22",
        "sort_index": 22,
        "service": "ssh",
        "version": "9.2p1 Debian 2+deb12u4",
        "state": "open",
        "protocol": "tcp",
        "product": "OpenSSH",
        "banner": "SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u4"
      }
    },
    "25": {
      "aux": {
        "port_number": "25",
        "sort_index": 25,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "110": {
      "aux": {
        "port_number": "110",
        "sort_index": 110,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "143": {
      "aux": {
        "port_number": "143",
        "sort_index": 143,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "465": {
      "aux": {
        "port_number": "465",
        "sort_index": 465,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "587": {
      "aux": {
        "port_number": "587",
        "sort_index": 587,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "993": {
      "aux": {
        "port_number": "993",
        "sort_index": 993,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "995": {
      "aux": {
        "port_number": "995",
        "sort_index": 995,
        "state": "open",
        "protocol": "tcp"
      }
    },
    "1256": {
      "aux": {
        "port_number": "1256",
        "sort_index": 1256,
        "service": "smtp",
        "state": "open",
        "protocol": "tcp",
        "product": "Postfix smtpd",
        "banner": "220 73ee2106e1c9 ESMTP Postfix (Ubuntu)"
      }
    },
    "5361": {
      "aux": {
        "port_number": "5361",
        "sort_index": 5361,
        "service": "imap",
        "state": "open",
        "protocol": "tcp",
        "product": "Dovecot imapd",
        "banner": "* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID \nENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot (Ubuntu) ready."
      }
    },
    "21514": {
      "aux": {
        "port_number": "21514",
        "sort_index": 21514,
        "service": "ftp",
        "version": "1.3.5e",
        "state": "open",
        "protocol": "tcp",
        "product": "ProFTPD",
        "banner": "220 ProFTPD 1.3.5e Server (Debian) 73ee2106e1c9"
      }
    },
    "23451": {
      "aux": {
        "port_number": "23451",
        "sort_index": 23451,
        "service": "pop3",
        "state": "open",
        "protocol": "tcp",
        "product": "zpop3d",
        "banner": "+OK POP3 Server ready"
      }
    }
  },
  "event_no": 1
}

families={
"port": {p.port_number: {"banner": p.banner} for p in host.ports}
refs={
f"{p.port_number}": {"aux": dataclasses.asdict(p)} for p in host.ports
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Aux" should either be "ancillary" or "adjunct" depending on what it means, exactly. "Aux" I think is an old term (deprecated) and will actually cause problem on Windows systems so should be explicitly avoided.

If it's an "arbitrary bunch of JSON" produced by discovery that's primarily meant for some ML pipeline to consume in order to handle mapping (so helps with understanding how a device is connected), then it should be "ancillary", if it's a key:string map of properties that describe how to contact/address the port (e.g. modbus parameters), then it should be "adjunct" -- it's not a hard line between them, so either would work in this case until we have a better idea of what they mean. The categories themselves are confusel too so we just kinda gotta roll with it for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is defined in the schema/events_discovery.json file.

@noursaidi noursaidi merged commit 0585205 into faucetsdn:master Mar 4, 2025
3 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants