Skip to content

Commit 1857cac

Browse files
authored
Correct CPE retrieval from XML
when multiple cpe are found by nmap the code was storing only the latest (which usually is the least relevant)
1 parent 3c2246b commit 1857cac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nmap3/nmapparser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ def parse_ports(self, xml_hosts):
173173

174174
if(port.find('service') is not None):
175175
open_ports["service"]=port.find("service").attrib
176-
176+
cpe_list = []
177177
for cp in port.find("service").findall("cpe"):
178-
cpe_list = []
178+
179179
cpe_list.append({"cpe": cp.text})
180-
open_ports["cpe"] = cpe_list
180+
open_ports["cpe"] = cpe_list
181181

182182
# Script
183183
open_ports["scripts"]=self.parse_scripts(port.findall('script')) if port.findall('script') is not None else []

0 commit comments

Comments
 (0)