FeeiCN / Cobra

Source Code Security Audit (源代码安全审计)

Home Page:http://cobra.feei.cn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

日志编码错误

billgavin opened this issue · comments

运行环境 ubuntu16.04 python3.5
--- Logging error ---
Traceback (most recent call last):
File "/root/cobra/cobra/log.py", line 67, in stdout_encode
ret = data.encode(sys.stdout.encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 786-793: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/cobra/cobra/log.py", line 117, in emit
message = stdout_encode(self.format(record))
File "/root/cobra/cobra/log.py", line 69, in stdout_encode
ret = data.encode(UNICODE_ENCODING) if isinstance(data, unicode) else data
NameError: name 'unicode' is not defined
Call stack:
File "cobra/cobra.py", line 22, in
sys.exit(main())
File "/root/cobra/cobra/init.py", line 110, in main
cli.start(args.target, args.format, args.output, args.special_rules, a_sid, args.dels)
File "/root/cobra/cobra/cli.py", line 94, in start
language=main_language, framework=main_framework, file_count=file_count, extension_count=len(files))
File "/root/cobra/cobra/engine.py", line 243, in scan
logger.info("[SCAN] Trigger Rules/Not Trigger Rules/Off Rules: {tr}/{ntr}/{fr} Vulnerabilities ({vn})\r\n{table}".format(tr=len(trigger_rules), ntr=len(diff_rules), fr=off_rules, vn=len(find_vulnerabilities), table=table))
File "/usr/lib64/python3.6/logging/init.py", line 1308, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib64/python3.6/logging/init.py", line 1444, in _log
self.handle(record)
File "/usr/lib64/python3.6/logging/init.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib64/python3.6/logging/init.py", line 1516, in callHandlers
hdlr.handle(record)
File "/usr/lib64/python3.6/logging/init.py", line 865, in handle
self.emit(record)
File "/root/cobra/cobra/log.py", line 134, in emit
self.handleError(record)

临时切换下本地语言,再执行试下?
LANG=C.UTF-8