Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit ade6207

Browse files
authored
Replaced standard XML module with 'defusedxml' for XML bomb protection
1 parent 54ee2b8 commit ade6207

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libnmap/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
try:
5-
import xml.etree.cElementTree as ET
5+
import defusedxml.cElementTree as parseXML
66
except ImportError:
7-
import xml.etree.ElementTree as ET
7+
import defusedxml.ElementTree as parseXML
88
from libnmap.objects import NmapHost, NmapService, NmapReport
99

1010

@@ -87,7 +87,7 @@ def _parse_xml(cls, nmap_data=None, incomplete=False):
8787
nmap_data += "</nmaprun>"
8888

8989
try:
90-
root = ET.fromstring(nmap_data)
90+
root = parseXML.fromstring(nmap_data)
9191
except:
9292
raise NmapParserException("Wrong XML structure: cannot parse data")
9393

0 commit comments

Comments
 (0)