-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrapeThePatchJSON-testforregex.py
More file actions
31 lines (25 loc) · 900 Bytes
/
scrapeThePatchJSON-testforregex.py
File metadata and controls
31 lines (25 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import re
# Specify the path to the JSON file
json_file_path = "file.json"
# Read the JSON data from the file
with open(json_file_path, "r") as file:
json_data = file.read()
# Parse the JSON data
data = json.loads(json_data)
# Define the regex pattern to search for
pattern = r"glibc.* < 2.31-150300.46.1"
# Iterate through the data to find the matching entry
for entry in data:
conflicts = entry.get("Conflicts", [])
for conflict in conflicts:
if re.search(pattern, conflict):
severity = entry.get("Severity")
category = entry.get("Category")
print("Severity:", severity)
print("Category:", category)
#print("Matching conflict:", conflict)
break # Exit the loop after finding the matching entry
else:
continue
break # Exit the outer loop after finding the matching entry