1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 20:51:30 +00:00

Avoid UnicodeDecodeError when reading nmap output. See #3087

This commit is contained in:
dmiller
2025-05-08 17:43:01 +00:00
parent b05b0b04ec
commit 84cf8b5840

View File

@@ -198,7 +198,8 @@ class NmapCommand(object):
# We don't need a file name for stdout output, just a handle. A # We don't need a file name for stdout output, just a handle. A
# TemporaryFile is deleted as soon as it is closed, and in Unix is # TemporaryFile is deleted as soon as it is closed, and in Unix is
# unlinked immediately after creation so it's not even visible. # unlinked immediately after creation so it's not even visible.
f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8") f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8",
errors='backslashreplace')
self.stdout_file = f self.stdout_file = f
if stderr is None: if stderr is None:
stderr = f stderr = f