NetExec icon indicating copy to clipboard operation
NetExec copied to clipboard

(Win) --log can't save lines containing ancient alien characters

Open bongobongoland opened this issue 1 year ago • 3 comments

--- Logging error ---
Traceback (most recent call last):
  File "logging\__init__.py", line 1113, in emit
  File "encodings\cp1251.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 130-136: character maps to <undefined>
Call stack:
  File "threading.py", line 1002, in _bootstrap
  File "threading.py", line 1045, in _bootstrap_inner
  File "threading.py", line 982, in run
  File "concurrent\futures\thread.py", line 83, in _worker
  File "concurrent\futures\thread.py", line 58, in run
  File "C:\Users\poopypants\AppData\Local\Temp\_MEI49042\nxc\protocols\smb.py", line 167, in __init__
    connection.__init__(self, args, db, host)
  File "connection.py", line 121, in __init__
  File "connection.py", line 174, in proto_flow
  File "connection.py", line 195, in call_cmd_args
  File "C:\Users\poopypants\AppData\Local\Temp\_MEI49042\nxc\protocols\smb.py", line 1109, in users
    return UserSamrDump(self).dump()
  File "C:\Users\poopypants\AppData\Local\Temp\_MEI49042\nxc\protocols\smb\samruser.py", line 61, in dump
    self.fetchList(rpctransport)
  File "C:\Users\poopypants\AppData\Local\Temp\_MEI49042\nxc\protocols\smb\samruser.py", line 121, in fetchList
    self.logger.highlight(f"{self.domain}\\{user['Name']:<30} {info_user}")
  File "logger.py", line 106, in highlight
  File "logger.py", line 131, in log_console_to_file
  File "logging\__init__.py", line 978, in handle
  File "logging\handlers.py", line 75, in emit
  File "logging\__init__.py", line 1230, in emit
  File "logging\__init__.py", line 1118, in emit

bongobongoland avatar Feb 09 '24 10:02 bongobongoland

Can you give me a character that produces that error?

NeffIsBack avatar Feb 09 '24 12:02 NeffIsBack

any Chinese or Thai characters.

bongobongoland avatar Feb 09 '24 21:02 bongobongoland

Would changing the default codec to utf-8 solve the problem? Is this compatible with Chinese characters?

NeffIsBack avatar May 26 '24 16:05 NeffIsBack