Search in sources :

Example 1 with ServiceDetails

use of com.xebia.vulnmanager.models.nmap.objects.ServiceDetails in project vulnmanager by xebia-research.

the class HostsParserHelper method getPort.

private HostPorts.Port getPort(Node currentNode) {
    NamedNodeMap portAttributesNode = currentNode.getAttributes();
    String protocol = portAttributesNode.getNamedItem(NMapConstants.PARSER_LITERAL_PROTOCOL).getNodeValue();
    String portId = portAttributesNode.getNamedItem(NMapConstants.PARSER_LITERAL_PORTID).getNodeValue();
    StateDetails stateDetails = null;
    ServiceDetails serviceDetails = null;
    NodeList portChildNodes = currentNode.getChildNodes();
    for (int i = 0; i < portChildNodes.getLength(); i++) {
        Node currentChildNode = portChildNodes.item(i);
        NamedNodeMap portAttributes = currentChildNode.getAttributes();
        if (currentChildNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_STATE)) {
            stateDetails = getStateDetails(portAttributes);
        } else if (currentChildNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_SERVICE)) {
            serviceDetails = getServiceDetails(portAttributes);
        }
    }
    return new HostPorts.Port(protocol, portId, stateDetails, serviceDetails);
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) ServiceDetails(com.xebia.vulnmanager.models.nmap.objects.ServiceDetails) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) StateDetails(com.xebia.vulnmanager.models.nmap.objects.StateDetails)

Aggregations

ServiceDetails (com.xebia.vulnmanager.models.nmap.objects.ServiceDetails)1 StateDetails (com.xebia.vulnmanager.models.nmap.objects.StateDetails)1 NamedNodeMap (org.w3c.dom.NamedNodeMap)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1