From e900144c3fa67f1438466c2de6fc6684dba2c896 Mon Sep 17 00:00:00 2001
From: Petr Svenda
Date: Wed, 20 Nov 2019 12:58:05 +0100
Subject: Added parsing of metadat from cc html page
---
src/search_certficate.py | 172 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 172 insertions(+)
(limited to 'src')
diff --git a/src/search_certficate.py b/src/search_certficate.py
index bf4e3dba..e7b550c0 100644
--- a/src/search_certficate.py
+++ b/src/search_certficate.py
@@ -97,6 +97,18 @@ def load_cert_file(file_name, limit_max_lines=-1, line_separator=LINE_SEPARATOR)
return whole_text, whole_text_with_newlines, was_unicode_decode_error
+def load_cert_html_file(file_name):
+ with open(file_name, 'r') as f:
+ try:
+ whole_text = f.read()
+ except UnicodeDecodeError:
+ f.close()
+ with open(file_name, encoding="utf8") as f2:
+ whole_text = f2.read()
+
+ return whole_text
+
+
def normalize_match_string(match):
# normalize match
match = match.strip()
@@ -161,6 +173,9 @@ def parse_cert_file(file_name, search_rules, limit_max_lines=-1, line_separator=
return items_found_all, (whole_text_with_newlines, was_unicode_decode_error)
+
+
+
def print_total_matches_in_files(all_items_found_count):
sorted_all_items_found_count = sorted(all_items_found_count.items(), key=operator.itemgetter(1))
for file_name_count in sorted_all_items_found_count:
@@ -689,6 +704,159 @@ def extract_certificates_keywords(walk_dir):
print('ERROR: less items found!')
print(error_less_matches_detected)
+
+def parse_product_updates(updates_chunk):
+ maintenance_reports = []
+ rule = '([0-9]+?-[0-9]+?-[0-9]+?) – (.+?)
...
+ start_pos = whole_text.find('