Giter VIP home page Giter VIP logo

sploitscan's Introduction

SploitScan

SPLOITSCAN-LOGO

πŸ“œ Description

SploitScan is a powerful and user-friendly tool designed to streamline the process of identifying exploits for known vulnerabilities and their respective exploitation probability. Empowering cybersecurity professionals with the capability to swiftly identify and apply known and test exploits. It's particularly valuable for professionals seeking to enhance their security measures or develop robust detection strategies against emerging threats.

πŸ“– Table of contents

🌟 Features

  • CVE Information Retrieval: Fetches CVE details from the National Vulnerability Database.
  • EPSS Integration: Includes Exploit Prediction Scoring System (EPSS) data, offering a probability score for the likelihood of CVE exploitation, aiding in prioritization.
  • Public Exploits Aggregation: Gathers publicly available exploits, enhancing the understanding of vulnerabilities.
  • CISA KEV: Shows if the CVE has been listed in the Known Exploited Vulnerabilities (KEV) of CISA.
  • AI-Powered Risk Assessment: Leverages OpenAI to provide detailed risk assessments, potential attack scenarios, mitigation recommendations, and executive summaries.
  • HackerOne Reports: Shows if the CVE was used within HackerOne Bug Bounty programs including their total rank overall and severity distribution.
  • Patching Priority System: Evaluates and assigns a priority rating for patching based on various factors including public exploits availability.
  • Multi-CVE Support and Export Options: Supports multiple CVEs in a single run and allows exporting the results to HTML, JSON and CSV formats.
  • Vulnerability Scanner Import: Import vulnerability scans from popular vulnerability scanners and search directly for known exploits.
  • User-Friendly Interface: Easy to use, providing clear and concise information.
  • Comprehensive Security Tool: Ideal for quick security assessments and staying informed about recent vulnerabilities.

sploitscan_v0 10 4

πŸ’£ Supported Exploit Databases

πŸ“ Supported Vulnerability Scanner Import

βš™οΈ Installation

GitHub

git clone https://github.com/xaitax/SploitScan.git
cd sploitscan
pip install -r requirements.txt

pip

pip install --user sploitscan

Kali/Ubuntu/Debian

apt install sploitscan

Configuration File

Create a config.json file in one of the following locations with your API keys:

  • Current directory
  • ~/.sploitscan/
  • ~/.config/sploitscan/
  • /etc/sploitscan/
  • ~/Library/Application Support/sploitscan/ (macOS)
  • %APPDATA%/sploitscan/ (Windows)

You can also specify a custom configuration file path using the --config or -c command-line argument.

{
  "vulncheck_api_key": "your_vulncheck_api_key",
  "openai_api_key": "your_openai_api_key"
}

πŸš€ Usage

$ sploitscan.py -h

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β•β•šβ•β•     β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•   β•šβ•β•   β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•β•
v0.10.3 / Alexander Hagenah / @xaitax / [email protected]

usage: sploitscan.py [-h] [-e {json,JSON,csv,CSV,html,HTML}] [-t {nessus,nexpose,openvas,docker}] [-i IMPORT_FILE] [-c CONFIG] [-d] [cve_ids ...]

SploitScan: Retrieve and display vulnerability data as well as public exploits for given CVE ID(s).

positional arguments:
  cve_ids               Enter one or more CVE IDs to fetch data. Separate multiple CVE IDs with spaces. Format for each ID: CVE-YYYY-NNNNN. This argument is optional if an import file is provided
                        using the -i option.

options:
  -h, --help            show this help message and exit
  -e {json,JSON,csv,CSV,html,HTML}, --export {json,JSON,csv,CSV,html,HTML}
                        Optional: Export the results to a JSON, CSV, or HTML file. Specify the format: 'json', 'csv', or 'html'.
  -t {nessus,nexpose,openvas,docker}, --type {nessus,nexpose,openvas,docker}
                        Specify the type of the import file: 'nessus', 'nexpose', 'openvas' or 'docker'.
  -i IMPORT_FILE, --import-file IMPORT_FILE
                        Path to an import file from a vulnerability scanner. If used, CVE IDs can be omitted from the command line arguments.
  -c CONFIG, --config CONFIG
                        Path to a custom config file.
  -d, --debug           Enable debug output.

Single CVE Query

sploitscan CVE-2024-1709

Multiple CVE Query

sploitscan CVE-2024-1709 CVE-2024-21413

Import from Vulnerability Scanner

Specify the type: 'nessus', 'nexpose', 'openvas', or 'docker' and provide the file path.

sploitscan --import-file path/to/yourfile.nessus --type nessus

Export Results

Specify the export format: 'json', 'csv', or 'html'.

sploitscan CVE-2024-1709 -e html

Docker

docker build -t sploitscan .
docker run --rm sploitscan CVE-2024-1709

With a volume mounted from the current directory

Windows (Powershell)

docker run -v ${PWD}:/app --rm sploitscan CVE-2024-1709 -e JSON

Linux

docker run -v $(pwd):/app --rm sploitscan CVE-2024-1709 -e JSON

πŸ€– AI-Powered Risk Assessment

SploitScan integrates with OpenAI to provide a comprehensive AI-powered risk assessment for each CVE. This feature includes:

  • Detailed Risk Assessment: Understand the nature of the vulnerability and its business impact.
  • Potential Attack Scenarios: Get descriptions of potential attack scenarios leveraging the vulnerability.
  • Mitigation Recommendations: Receive specific, actionable recommendations to mitigate the risk.
  • Executive Summary: A concise summary accessible to non-technical stakeholders, highlighting the business impact and urgency.

Example output


$ sploitscan.py CVE-2024-21413

[...]

β”Œβ”€β”€β”€[ πŸ€– AI-Powered Risk Assessment ]
|
| 1. Risk Assessment
| -------------------
| The vulnerability identified by CVE-2024-21413 is a critical remote code execution flaw in
| Microsoft Outlook with a CVSS score of 9.8. The impact on business operations can be severe due to
| its high potential to be exploited over a network without any user interactions or elevated
| privileges. This unvalidated input vulnerability (CWE-20) could allow an attacker to execute
| arbitrary code on the target system, thereby compromising the confidentiality, integrity, and
| availability of critical business data and systems. Given its critical rating and the existence of
| multiple exploits on public repositories like GitHub, the likelihood of exploitation is very high.
| This necessitates immediate attention from the security teams to mitigate the risks associated.
|
| 2. Potential Attack Scenarios
| ------------------------------
| An attacker could exploit this vulnerability by sending a specially crafted email to a victim
| using Microsoft Outlook. Once the email is opened or previewed, the malicious payload would
| execute, allowing the attacker to gain control over the victim's system. The process involves: 1.
| Crafting a malicious email leveraging the specific flaw in email handling within Microsoft
| Outlook. 2. Sending the email to the intended victim. 3. Upon opening or previewing the email, the
| victim’s system executes the malicious code. The potential outcomes of this attack include theft
| of sensitive information, installation of malware or ransomware, and compromising other systems
| within the same network due to lateral movement capabilities.
|
| 3. Mitigation Recommendations
| ------------------------------
| Immediate mitigation recommendation includes: 1. Applying the latest security patches provided by
| Microsoft. Reference: https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-21413 2.
| Implementing network-level protections such as email filtering and network segmentation to limit
| the spread of potential infections. 3. Conducting regular security awareness training for users to
| recognize phishing and malicious emails. 4. Monitoring network and system activity for signs of
| suspicious behavior and unauthorized execution. 5. Regularly backing up critical data and ensuring
| the integrity of backups.
|
| 4. Executive Summary
| ---------------------
| CVE-2024-21413, a critical remote code execution vulnerability in Microsoft Outlook, poses a
| significant risk to businesses due to its potential to be exploited without user interaction.
| Multiple exploit proofs are publicly available, increasing the likelihood of attacks.
| Organizations must act swiftly by applying the necessary patches from Microsoft, enhancing their
| email security protocols, and educating their staff to identify potential phishing attempts.
| Mitigating this vulnerability is essential to protect sensitive information, maintain business
| integrity, and ensure system availability, thus preventing potential financial and reputational
| damage. Immediate action is crucial to safeguard the organization against this severe threat.
|
└────────────────────────────────────────

πŸ›‘οΈ Patching Priority System

The Patching Prioritization System in SploitScan provides a strategic approach to prioritizing security patches based on the severity and exploitability of vulnerabilities. It's influenced by the model from CVE Prioritizer, with enhancements for handling publicly available exploits. Here's how it works:

  • A+ Priority: Assigned to CVEs listed in CISA's KEV or those with publicly available exploits. This reflects the highest risk and urgency for patching.
  • A to D Priority: Based on a combination of CVSS scores and EPSS probability percentages. The decision matrix is as follows:
    • A: CVSS score >= 6.0 and EPSS score >= 0.2. High severity with a significant probability of exploitation.
    • B: CVSS score >= 6.0 but EPSS score < 0.2. High severity but lower probability of exploitation.
    • C: CVSS score < 6.0 and EPSS score >= 0.2. Lower severity but higher probability of exploitation.
    • D: CVSS score < 6.0 and EPSS score < 0.2. Lower severity and lower probability of exploitation.

This system assists users in making informed decisions on which vulnerabilities to patch first, considering both their potential impact and the likelihood of exploitation. Thresholds can be changed to your business needs.

πŸ«±πŸΌβ€πŸ«²πŸ½ Contributing

Contributions are welcome. Please feel free to fork, modify, and make pull requests or report issues.

Special thanks to:

πŸ“Œ Author

Alexander Hagenah

πŸ“š References

sploitscan's People

Contributors

bcoles avatar con-f-use avatar davidfortytwo avatar katseyres2 avatar xaitax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sploitscan's Issues

Read archive with CVEs

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`

API key for VulnCheck is not configured correctly

Hi,

I copied my VulnCheck API key to config.json file like this:

{
"vulncheck_api_key": "vulncheck_64b239d2f920 [etc..long alphanum string]...644a043",
"openai_api_key": ""
}

I have this config file in local directory, and in ~/.config/sploitscan and /etc/sploitscan directories.
I keep getting the error as in the title above:

"API key for VulnCheck is not configured correctly"

In html export file the section "VulnCheck exploits" is empty... Not even "N/A" as in other empty sections.

Regards,
cikasole

Sometime crash with 'not enough values to unpack (expected 2, got 1)' for some CVE IDs

I'm using the version packaged by Debian: sploitscan/unstable,now 0.10.3-1
for some CVE IDs (not all), sploiscan crash (CVE-2024-36387 is OK for example)

❯ sploitscan CVE-2024-5535

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β•β•šβ•β•     β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•   β•šβ•β•   β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•β•
v0.10.3 / Alexander Hagenah / @xaitax / [email protected]

╔═══════════════════════╗
β•‘ CVE ID: CVE-2024-5535 β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

β”Œβ”€β”€β”€[ πŸ” Vulnerability information ]
|
β”œ Published:   2024-06-27
β”œ Base Score:  N/A (N/A)
β”œ Vector:      N/A
β”” Description: 

[…]

β”Œβ”€β”€β”€[ ♾️  Exploit Prediction Score (EPSS) ]
|
β”” EPSS Score:  0.04% Probability of exploitation.

β”Œβ”€β”€β”€[ πŸ›‘οΈ  CISA KEV Catalog ]
|
β”” ❌ No data found.

Traceback (most recent call last):
  File "/usr/bin/sploitscan", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3/dist-packages/sploitscan/sploitscan.py", line 1067, in cli
    main(args.cve_ids, args.export, args.import_file, args.type, args.config, args.debug)
  File "/usr/lib/python3/dist-packages/sploitscan/sploitscan.py", line 984, in main
    public_exploits = fetch_and_display_public_exploits(cve_id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/sploitscan/sploitscan.py", line 880, in fetch_and_display_public_exploits
    display_public_exploits(github_data, vulncheck_data, exploitdb_data, packetstorm_data, nuclei_data, vulncheck_error)
  File "/usr/lib/python3/dist-packages/sploitscan/sploitscan.py", line 365, in display_public_exploits
    exploits, total = template(True)
    ^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

Error while exporting to html

Hi,

I get an error with this CVE code:

└─# ./sploitscan.py CVE-2023-5678 -e html
....
....
Error exporting to HTML: 'dict object' has no attribute 'cvssV3_1'

I tried export to csv, and it works fine.
Can you, please, help me with this?

Best regards,
cikasole

File location

Hi Alexander!
I hope you are well!
It's always good to talk to you!

There is an RC bug open for sploitscan and I need to close it:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1072816

The problem is that there are two files in the main package:
config.json
templates/report_template.html

I would like to know if they are necessary for the module to function?

If not, I will move to another location.
If you can explain I would be very grateful as I will reference this issue when closing Bug RC.

grateful!

Search Exploit in ExploitDB

I implemented a query in exploitDB, where it queries the existence of exploits for that CVE. I believe this new implemented base could be interesting

`def fetch_exploitdb_data(cve_id):
try:
response = requests.get("https://gitlab.com/exploit-database/exploitdb/-/raw/main/files_exploits.csv?ref_type=heads")
response.raise_for_status()
exploitdb_data = response.text

    # Procurando a CVE no campo "codes"
    cve_pattern = re.compile(r"CVE-\d{4}-\d{4,7}")
    csv_reader = csv.DictReader(exploitdb_data.splitlines())
    relevant_data = []
    for row in csv_reader:
        if cve_pattern.search(row["codes"]) and cve_id in row["codes"]:
            relevant_data.append(row)
    
    return relevant_data
    
except requests.exceptions.RequestException as e:
    print(f"❌ An error occurred fetching exploitdb data: {e}")
    return None

def display_exploitdb_data(exploitdb_data, cve_id):
if exploitdb_data:
print("ExploitDB Data:\n")
headers = ["Name", "Author", "Date", "URL"]
table = []

    for data in exploitdb_data:
        cve_id_display = cve_id
        date_published = data.get("date", "N/A")
        author = data.get("author", "N/A")
        exploit_id = data.get("id", "N/A")
        url = f"https://www.exploit-db.com/exploits/{exploit_id}"

        row = [cve_id_display, author, date_published, url]
        table.append(row)

    print(tabulate(table, headers=headers, tablefmt="fancy_grid") + "\n")
else:
    print("No ExploitDB data found.\n")`

IndexError: list index out of range while processing EPSS data

Hello, Alexander,

I'd like to report that trying to run the current git version of Sploitscan, I get the following strack trace:

$ python3 ./sploitscan.py CVE-2024-7589
...
v0.10.4 / Alexander Hagenah / @xaitax / [email protected]
...
───[ ♾️ Exploit Prediction Score (EPSS) ]
|
β”” ❌ No data found.
...
β”Œβ”€β”€β”€[ πŸ•΅οΈ HackerOne Hacktivity ]
|
β”” ❌ No data found.

Traceback (most recent call last):
  File "/tmp/SploitScan/./sploitscan.py", line 6, in <module>
    cli()
  File "/tmp/SploitScan/sploitscan/sploitscan.py", line 1084, in cli
    main(args.cve_ids, args.export, args.import_file, args.type, args.config, args.debug)
  File "/tmp/SploitScan/sploitscan/sploitscan.py", line 1004, in main
    cve_details = compile_cve_details(cve_id, cve_data, epss_data, relevant_cisa_data, public_exploits)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/SploitScan/sploitscan/sploitscan.py", line 935, in compile_cve_details
    epss_score = epss_data["data"][0].get("epss", "N/A") if epss_data and "data" in epss_data else "N/A"
                 ~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Read CVSS 2.0

I change the code so that it can read oldest CVSS type 2.0, but always giving priority to 3.x

`def display_nvd_data(cve_data):
if (
cve_data
and "vulnerabilities" in cve_data
and len(cve_data["vulnerabilities"]) > 0
):
cve_item = cve_data["vulnerabilities"][0]["cve"]
published = cve_item.get("published", "")
if published:
published_date = datetime.datetime.fromisoformat(published)
published = published_date.strftime("%Y-%m-%d")

    descriptions = cve_item.get("descriptions", [])
    description = next(
        (desc["value"] for desc in descriptions if desc["lang"] == "en"),
        "No description available",
    )

    metrics = cve_item.get("metrics", {})
    baseScore = baseSeverity = vectorString = "N/A"

    # First try to get CVSS v3*
    for key, value in metrics.items():
        if key.startswith("cvssMetricV3"):
            cvss_data = value[0].get("cvssData", {})
            baseScore = cvss_data.get("baseScore", "N/A")
            baseSeverity = cvss_data.get("baseSeverity", "N/A")
            vectorString = cvss_data.get("vectorString", "N/A")
            break  # Stop at the first occurrence

    # If CVSS v3* is not available, try to get CVSS v2
    if baseScore == "N/A":
        for key, value in metrics.items():
            if key.startswith("cvssMetricV2"):
                cvss_data = value[0].get("cvssData", {})
                baseScore = cvss_data.get("baseScore", "N/A")
                baseSeverity = cvss_data.get("baseSeverity", "N/A")
                vectorString = cvss_data.get("vectorString", "N/A")
                break  # Stop at the first occurrence

    label_width = max(
        len("Description:"),
        len("Published:"),
        len("Base Score:"),
        len("Base Severity:"),
        len("Vector String:"),
    )
    description_label = "Description:".ljust(label_width)
    published_label = "Published:".ljust(label_width)
    base_score_label = "Base Score:".ljust(label_width)
    base_severity_label = "Base Severity:".ljust(label_width)
    vector_string_label = "Vector String:".ljust(label_width)

    print(
        f"\n{description_label} {description}\n"
        f"{published_label} {published}\n"
        f"{base_score_label} {baseScore}\n"
        f"{base_severity_label} {baseSeverity}\n"
        f"{vector_string_label} {vectorString}\n"
    )
else:
    print("\n❌ No NVD data found for this CVE ID.\n")`

Package for Debian

Hi!
I'm a Debian packager, I found your work interesting. I'm taking it to our distro.
I noticed that you didn't make the setupy /pyproject.tolm configuration file available.
What version of this project would be? Would you like to version it?

Nilson

API Key issues with load_config() logic and config.json issues

Parsing API keys took a few stabs...

  1. Config.json, despite creating in ~/.sploitscan/ will not be honoured in current logic if the default one provided is not removed, which isn't necessarily clear in the instructions/README
  2. Config.json, kept complaining about "Error decoding JSON from the config file", and after adding some debugging to the code, python 3.12.3 on Ubuntu 24 complained about the extra spaces between colon : and start of variable in double quotes "Error decoding JSON from the config file /home/jasonh/SploitScan/sploitscan/config.json: Expecting property name enclosed in double quotes: line 2 column 1 (char 2)". Removing the extra space helped.
  3. Made some minor code changes to better handle errors during load_config, you may wish to consider these
def load_config():
    default_config = {"vulncheck_api_key": None, "openai_api_key": None}
    base_path = os.path.dirname(os.path.abspath(__file__))
    config_paths = [
        os.path.join(base_path, "config.json"),
        os.path.expanduser("~/.sploitscan/config.json"),
        os.path.expanduser("~/.config/sploitscan/config.json"),
        "/etc/sploitscan/config.json",
    ]

    for config_path in config_paths:
        if os.path.exists(config_path):
            try:
                print(f"Attempting to load config file from: {config_path}")  # Debugging statement
                with open(config_path, "r", encoding="utf-8") as file:
                    config = json.load(file)
                    print(f"Successfully loaded config file: {config_path}")  # Debugging statement
                    return config
            except json.JSONDecodeError as e:
                print(f"⚠️ Error decoding JSON from the config file {config_path}: {e}")
            except Exception as e:
                print(f"⚠️ Unexpected error reading config file {config_path}: {e}")
    
    print("⚠️ Config file not found in any checked locations, using default settings.")
    return default_config

docker setting config.json

when i creat config.json file on the $(pwd) .

sudo docker run -v $(pwd)config.json:/etc/sploitscan/config.json --rm sploitscan CVE-2024-1709
β”Œβ”€β”€β”€[ ο’₯ VulnCheck Exploits ]
|
β”” API key for VulnCheck is not configured correctly.

β”Œβ”€β”€β”€[ ο€– AI-Powered Risk Assessment ]
|
| ❌ OpenAI API key is not configured correctly.
|
└────────────────────────────────────────

Error with variable vulncheck_data: 'NoneType' object has no attribute 'get'

When vulncheck_data is "None" the script gives the following error
https://github.com/xaitax/SploitScan/blob/main/sploitscan.py#L385

Traceback (most recent call last):
  File "/usr/bin/sploitscan", line 31, in <module>
    main(args.cve_ids, args.export)
  File "/usr/share/sploitscan/sploitscan.py", line 708, in main
    cve_result = collect_cve_data(cve_id)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/sploitscan/sploitscan.py", line 658, in collect_cve_data
    priority = calculate_priority(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/share/sploitscan/sploitscan.py", line 385, in calculate_priority
    or bool(vulncheck_data.get("data"))
            ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

Nessus import errors

Have tried importing two different nessus files and both have returned the same error. Am not the best with python, so any thoughts? Is this coding, or did I miss a syntax where I needed to provide an api key?

Syntax used:
python sploitscan.py --import-file /path/to/file/filename.nessus --type nessus

Fetching GitHub exploits / PoC:

❌ An error occurred fetching PoC data: HTTPSConnectionPool(host='poc-in-github.motikan2010.net', port=443): Max retries exceeded with url: /api/v1/?cve_id=CVE-2012-0159&sort=stargazers_count (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')))
Traceback (most recent call last):
File "/home/kali/Desktop/SploitScan/sploitscan.py", line 703, in
main(args.cve_ids, args.export, args.import_file, args.type)
File "/home/kali/Desktop/SploitScan/sploitscan.py", line 586, in main
cve_result = collect_cve_data(cve_id)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/Desktop/SploitScan/sploitscan.py", line 622, in collect_cve_data
display_github_data(github_data)
File "/home/kali/Desktop/SploitScan/sploitscan.py", line 164, in display_github_data
if "pocs" in data and len(data["pocs"]) > 0:
^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

AI-Powered Risk Assessment Error

I put in my API key from OpenAI and edited in the conf file. When I run with a nessus file, I got this error.

β”Œβ”€β”€β”€[ πŸ€– AI-Powered Risk Assessment ] | | ❌ Error fetching data from OpenAI: Error code: 404 - {'error': {'message': 'The model `gpt-4o` | does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, | 'code': 'model_not_found'}}

include python3 shebang

w0rd up,

nice work, minimal change proposal: how about including

#!/usr/bin/env python3

in the first line of sploitscan.py,

regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.