From 1c632bf5935ec5a3873d6402d9ccd3560a0f5d98 Mon Sep 17 00:00:00 2001 From: code4lala Date: Wed, 20 Sep 2023 03:28:45 +0000 Subject: [PATCH] ignore log decoding errors Signed-off-by: code4lala --- README.md | 3 +++ log2policy/trans_avc_rule.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4fccf9..62c1922 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ selinux 工具仓, #### 软件架构 + +``` └─log2policy //日志转selinux策略工具 ├─bin //一些python脚本用到的二进制,如cat ├─format_out //格式化以后的selinux策略输出目录,最终输出结果存放在这 @@ -11,3 +13,4 @@ selinux 工具仓, ├─out //中间文件输出目录 ├─sort_out //排序后selinux策略存放目录 └─一键运行.bat //支持一键运行的脚本 +``` diff --git a/log2policy/trans_avc_rule.py b/log2policy/trans_avc_rule.py index 84cf63c..cde83c4 100644 --- a/log2policy/trans_avc_rule.py +++ b/log2policy/trans_avc_rule.py @@ -20,7 +20,7 @@ file_title = '# Copyright (c) 2023 Huawei Device Co., Ltd.\n\ # limitations under the License.\n\n' def read_file(path, word, type_hash): - file = open(path, 'r', encoding='UTF-8') + file = open(path, 'r', encoding='UTF-8', errors='ignore') file2 = open("out/tmp.txt", 'w+') file_line = file.readlines() for line in file_line: -- Gitee