xaitax / SploitScan

SploitScan is a sophisticated cybersecurity utility designed to provide detailed information on vulnerabilities and associated exploits.
GNU General Public License v3.0
923 stars 114 forks source link

Read archive with CVEs #8

Closed Romullo closed 8 months ago

Romullo commented 8 months ago

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()

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`
xaitax commented 8 months ago

The NIST API will likely block due to amount of requests.