Azure-Sentinel icon indicating copy to clipboard operation
Azure-Sentinel copied to clipboard

cef_troubleshoot.py error

Open iho77 opened this issue 6 years ago • 2 comments

https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/CEF/cef_troubleshoot.py exiting with errors on Ubuntu 18.04.3 LTS with Russian locale

Traceback (most recent call last): File "cef_troubleshoot.py", line 632, in main() File "cef_troubleshoot.py", line 610, in main security_config_omsagent_test(workspace_id=workspace_id) File "cef_troubleshoot.py", line 451, in security_config_omsagent_test is_security_config_omsagent_dir_exists = check_file_in_directory("security_events.conf", path) File "cef_troubleshoot.py", line 309, in check_file_in_directory output = o.decode('ascii') UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 35: ordinal not in range(128)

Problem is in 299 line def check_file_in_directory(file_name, path): ''' Check if the given file is found in the current directory. :param path: :param file_name: :return: return True if it is found elsewhere False ''' current_dir = subprocess.Popen(["ls", "-ltrh", path], stdout=subprocess.PIPE) grep = subprocess.Popen(["grep", "-i", file_name], stdin=current_dir.stdout, stdout=subprocess.PIPE) o, e = grep.communicate() output = o.decode('ascii') if e is None and file_name in output: return True return False

if we change output = o.decode('ascii') to output = o.decode(' 'utf8'') - everething is fine

iho77 avatar Jan 31 '20 14:01 iho77

Hi @imelekhin ,

thanks for your input, the issue has been fixed.

thanks,

Ron

Ronmarsiano avatar Feb 18 '20 08:02 Ronmarsiano

@imelekhin - Can you confirm for us the issue has been fixed? If so, I will close this issue. Thanks, Shain

shainw avatar Feb 21 '20 14:02 shainw