diff --git a/index.js b/index.js index fb15216..d2d32ac 100644 --- a/index.js +++ b/index.js @@ -69,22 +69,20 @@ function convertRawJsonToScanResults(xmlInput) { newHost.openPorts = openPorts.map((portItem) => { // console.log(JSON.stringify(portItem, null, 4)) + let portObject = {} const port = parseInt(portItem.$.portid) const protocol = portItem.$.protocol + if(port) portObject.port = port + if(protocol) portObject.protocol = protocol + if (portItem.service) { const service = portItem.service[0].$.name const tunnel = portItem.service[0].$.tunnel const method = portItem.service[0].$.method const product = portItem.service[0].$.tunnel - } - let portObject = {} - if(port) portObject.port = port - if(protocol) portObject.protocol = protocol - - if (portItem.service) { if(service) portObject.service = service if(tunnel) portObject.tunnel = tunnel if(method) portObject.method = method