diff --git a/zenmap/zenmapCore/NmapParser.py b/zenmap/zenmapCore/NmapParser.py index d6b08fd..7010fa5 100644 --- a/zenmap/zenmapCore/NmapParser.py +++ b/zenmap/zenmapCore/NmapParser.py @@ -481,7 +481,7 @@ class ParserBasics(object): } self.ops = NmapOptions() - self._nmap_output = StringIO() + self._nmap_output = [] def set_xml_is_temp(self, xml_is_temp): # This flag is False if a user has specified his own -oX option - in @@ -503,17 +503,13 @@ class ParserBasics(object): self.ops.target_specs = targets def get_nmap_output(self): - return self._nmap_output.getvalue() + return ''.join(self._nmap_output) def set_nmap_output(self, nmap_output): - self._nmap_output.close() - del self._nmap_output - self._nmap_output = StringIO() - self._nmap_output.write(nmap_output) + self._nmap_output = [nmap_output] def del_nmap_output(self): - self._nmap_output.close() - del _nmap_output + self._nmap_output = [] def get_debugging_level(self): return self.nmap.get('debugging', '') @@ -1069,7 +1065,7 @@ class NmapParserSAX(ParserBasics, ContentHandler): def characters(self, content): if self.in_interactive_output: - self._nmap_output.write(content) + self._nmap_output.append(content) def write_text(self, f): """Write the Nmap text output of this object to the file-like object