Skip to content

Service information should be optional #7

@sciguy16

Description

@sciguy16

I've got an Nmap file where not all of the discovered ports have identified services. Two problems:

  • The error message references state instead of service
  • The code expects to find a service, but this is apparently optional

let service_info =
service_info.ok_or_else(|| Error::from("expected `state` attribute for port"))?;

Here's a relevant chunk of the XML file:

<host starttime="1601435740" endtime="1601443647">
	<status state="up" reason="user-set" reason_ttl="0"/>
	<address addr="redacted" addrtype="ipv4"/>
	<hostnames>
		<hostname name="redacted" type="PTR"/>
	</hostnames>
	<ports>
		<extraports state="closed" count="65531">
			<extrareasons reason="resets" count="65531"/>
		</extraports>
		<port protocol="tcp" portid="443">
			<state state="open" reason="syn-ack" reason_ttl="246"/>
			<service name="https" method="table" conf="3"/>
		</port>
		<port protocol="tcp" portid="64443">
			<state state="open" reason="syn-ack" reason_ttl="246"/>
		</port>
	</ports>
	<times srtt="58747" rttvar="9426" to="100000"/>
</host>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions