use of com.xebia.vulnmanager.models.nmap.objects.HostPorts in project vulnmanager by xebia-research.
the class HostsParserHelper method getPortDetails.
private HostPorts getPortDetails(NodeList portsAttributes) {
List<HostPorts.Port> hostPortsDetailsList = new ArrayList<>();
List<HostPorts.ExtraPort> extraPortsDetailsList = new ArrayList<>();
for (int x = 0; x < portsAttributes.getLength(); x++) {
Node currentNode = portsAttributes.item(x);
if (currentNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_PORT)) {
HostPorts.Port currentPort = getPort(currentNode);
hostPortsDetailsList.add(currentPort);
} else if (currentNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_EXTRA_PORTS)) {
HostPorts.ExtraPort extraPort = getExtraPorts(currentNode);
extraPortsDetailsList.add(extraPort);
}
}
return new HostPorts(hostPortsDetailsList, extraPortsDetailsList);
}
use of com.xebia.vulnmanager.models.nmap.objects.HostPorts in project vulnmanager by xebia-research.
the class HostsParserHelper method parseHostDataFromNodeList.
private Host parseHostDataFromNodeList(NodeList hostDataList) {
StateDetails stateDetails = null;
AddressDetails addressDetails = null;
HostNamesDetails hostNamesDetails = null;
HostPorts hostPorts = null;
TimingData timingData = null;
for (int x = 0; x < hostDataList.getLength(); x++) {
Node currentHostDetail = hostDataList.item(x);
NamedNodeMap currentChildAttributes = currentHostDetail.getAttributes();
String currentNodeName = currentHostDetail.getNodeName();
switch(currentNodeName) {
case NMapConstants.PARSER_LITERAL_STATUS:
stateDetails = getStatusDetails(currentChildAttributes);
break;
case NMapConstants.PARSER_LITERAL_ADDRESS:
addressDetails = getAddressDetails(currentChildAttributes);
break;
case NMapConstants.PARSER_LITERAL_HOST_NAMES:
hostNamesDetails = getHostNamesDetails(currentHostDetail.getChildNodes());
break;
case NMapConstants.PARSER_LITERAL_PORTS:
hostPorts = getPortDetails(currentHostDetail.getChildNodes());
break;
case NMapConstants.PARSER_LITERAL_TIMES:
timingData = getTimingData(currentChildAttributes);
break;
default:
break;
}
}
return new Host(stateDetails, addressDetails, hostNamesDetails, hostPorts, timingData);
}
Aggregations