From d57877077f5d1df970bb043a3e1bc2116a026096 Mon Sep 17 00:00:00 2001 From: Carlos Polop Date: Fri, 4 Feb 2022 01:13:04 +0000 Subject: [PATCH] Update peass-parser.py --- parser/peass-parser.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parser/peass-parser.py b/parser/peass-parser.py index dc1a5f5..6563093 100755 --- a/parser/peass-parser.py +++ b/parser/peass-parser.py @@ -5,9 +5,9 @@ import re import json # Pattern to identify main section titles -TITLE1_PATTERN = r"════════════════════════════════════╣" +TITLE1_PATTERN = r"══════════════╣" # The size of the first pattern varies, but at least should be that large TITLE2_PATTERN = r"╔══════════╣" -TITLE3_PATTERN = r"╔═╣" +TITLE3_PATTERN = r"══╣" INFO_PATTERN = r"╚ " TITLE_CHARS = ['═', '╔', '╣', '╚'] @@ -75,10 +75,10 @@ def clean_title(line: str) -> str: def clean_colors(line: str) -> str: """Given a line clean the colors inside of it""" - for reg in re.findall(r'\x1b[^ ]+\dm', line): + for reg in re.findall(r'\x1b\[[^a-zA-Z]+\dm', line): line = line.replace(reg,"") - line = line.replace('\x1b',"") #Sometimes that byte stays + line = line.replace('\x1b',"").replace("[0m", "") #Sometimes that byte stays line = line.strip() return line @@ -124,8 +124,8 @@ def parse_line(line: str): C_SECTION["lines"].append({ "raw_text": line, - "clean_text": clean_colors(line), - "colors": get_colors(line) + "colors": get_colors(line), + "clean_text": clean_title(clean_colors(line)) })