Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zenmap UnicodeEncodeError crash while saving scans #2820

Open
Avi8962 opened this issue Apr 25, 2024 · 3 comments
Open

Zenmap UnicodeEncodeError crash while saving scans #2820

Avi8962 opened this issue Apr 25, 2024 · 3 comments
Labels

Comments

@Avi8962
Copy link

Avi8962 commented Apr 25, 2024

Describe the bug
Version: 7.95
Traceback (most recent call last):
File "C:\Program Files (x86)\Nmap\zenmap\lib\python3.11\site-packages\zenmapGUI\MainWindow.py", line 629, in _save_scan_results_cb
self._save(self.scan_interface, filename, selected, format)
File "C:\Program Files (x86)\Nmap\zenmap\lib\python3.11\site-packages\zenmapGUI\MainWindow.py", line 711, in _save
scan_interface.inventory.save_to_file(
File "C:\Program Files (x86)\Nmap\zenmap\lib\python3.11\site-packages\zenmapCore\NetworkInventory.py", line 291, in save_to_file
self.get_scans()[index].write_xml(f)
File "C:\Program Files (x86)\Nmap\zenmap\lib\python3.11\site-packages\zenmapCore\NmapParser.py", line 1020, in write_xml
self._write_hosts(writer)
File "C:\Program Files (x86)\Nmap\zenmap\lib\python3.11\site-packages\zenmapCore\NmapParser.py", line 1101, in _write_hosts
writer.startElement("address",
File "../lib/python3.11/xml/sax/saxutils.py", line 170, in startElement
File "../lib/python3.11/encodings/cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 37-38: character maps to

To Reproduce
Steps to reproduce the behavior, including window titles and command-line options.

Expected behavior
A clear and concise description of what you expected to happen.

Version info (please complete the following information):

  • OS: [e.g. Linux 4.15, Windows 10 1909]
  • Zenmap version from Help -> About
  • Output of nmap --version:

Additional context
Add any other context about the problem here, such as special network type.

@Avi8962 Avi8962 added the Zenmap label Apr 25, 2024
@fyodor
Copy link
Member

fyodor commented Apr 25, 2024

Thanks @Avi8962 . We've received similar-sounding reports for Nmap 7.94 as well, such as this one. Interestingly both your report and that one are using cp1252, Window's Latin code page. It is probably related to our Python3 upgrade as that introduced dramatic Unicode changes. We should be saving in UTF-8. We'll investigate further. Thanks again!

@fyodor
Copy link
Member

fyodor commented Apr 25, 2024

Update: @dmiller-nmap has done an initial investigation and found that xml.sax.saxutils.XMLGenerator defaults to 'iso-8859-1' encoding. He is changing that to 'utf-8', which we hope will fix the problem.

@fyodor fyodor changed the title found error during saving the result Zenmap UnicodeEncodeError crash while saving scans Apr 25, 2024
@fyodor fyodor mentioned this issue May 16, 2024
@fyodor
Copy link
Member

fyodor commented May 16, 2024

We should make sure our fix also addresses the similar #2842 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants