I thought about implementing a file entry, where it reads the file that contains the CVEs. This way, if the user wants to check a file with more CVEs, the input may be better.
try:
if file_path.endswith('.csv'):
data = pd.read_csv(file_path)
elif file_path.endswith('.xlsx'):
data = pd.read_excel(file_path)
elif file_path.endswith('.json'):
data = pd.read_json(file_path)
else:
with open(file_path, 'r') as file:
data = file.read()
cves_found = re.findall(cve_pattern, str(data))
cve_ids.update(cves_found)
except Exception as e:
print(f"Erro ao ler o arquivo: {e}")
return cve_ids`
I thought about implementing a file entry, where it reads the file that contains the CVEs. This way, if the user wants to check a file with more CVEs, the input may be better.
`import pandas as pd
def read_cve_ids(file_path): cve_pattern = r'\bCVE-\d{4}-\d{4,7}\b' cve_ids = set()