pax_global_header00006660000000000000000000000064151016650100014505gustar00rootroot0000000000000052 comment=7f01a5154683a9ff77e1d9a4bfa0df7b25580083 SploitScan-0.14.3/000077500000000000000000000000001510166501000136515ustar00rootroot00000000000000SploitScan-0.14.3/.github/000077500000000000000000000000001510166501000152115ustar00rootroot00000000000000SploitScan-0.14.3/.github/dependabot.yml000066400000000000000000000002351510166501000200410ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: pip directory: "/" schedule: interval: daily open-pull-requests-limit: 5 target-branch: mainSploitScan-0.14.3/.github/workflows/000077500000000000000000000000001510166501000172465ustar00rootroot00000000000000SploitScan-0.14.3/.github/workflows/release.yml000066400000000000000000000013341510166501000214120ustar00rootroot00000000000000name: Release on: push: tags: - 'v*.*.*' permissions: contents: read jobs: build-and-publish: runs-on: ubuntu-latest steps: - name: Check out the code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.8' - name: Install build tools run: | python -m pip install --upgrade pip pip install build twine - name: Build the wheel run: python -m build - name: Publish to PyPI env: TWINE_USERNAME: "__token__" TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: twine upload dist/* - name: Cleanup build files run: rm -rf dist build *.egg-info SploitScan-0.14.3/.gitignore000066400000000000000000000000361510166501000156400ustar00rootroot00000000000000 sploitscan/config.json *.pyc SploitScan-0.14.3/CHANGELOG.md000066400000000000000000000236601510166501000154710ustar00rootroot00000000000000# πŸ“† Changelog ## [02. November 2025] - Version 0.14.3 - **Enhanced Patching Prioritization Calculation** - **Dependabot added** *Special thanks to [Manuel Sommer](https://github.com/manuel-sommer) for the improvements.* ## [18. October 2025] - Version 0.14.2 - **Directory Import Feature** Added support for importing CVE IDs from entire directories containing vulnerability reports. Use `--input-dir` to recursively scan directories and extract CVE IDs from all files. This complements the existing file import functionality and supports batch processing of multiple scanner reports. - **Docker Improvements** Updated Dockerfile to Python 3.13, added virtual environment setup, installed git for repository operations, and created a dedicated `/results` directory for exports. - **Export Path Enhancement** Modified export file generation to save results in `/results` directory when available. *Special thanks to [diwskx](https://github.com/diwskx) for the directory import feature and Docker improvements.* ## [07. October 2025] - Version 0.14.0 - **Modern modular refactor** Reorganized the codebase into clear modules (fetchers, metrics, display, AI providers, importers, exporters, utils) while keeping the CLI usage and output intact. The legacy wrapper now safely delegates to the new CLI and supports both β€œpython -m sploitscan” and direct script execution. - **HTML export redesign** Complete report refresh with Tailwind (CDN) styling: dark mode toggle, sticky header, sidebar filters, sortable summary table, responsive detail cards, and a readable AI section. Kept a zero‑build setup; distro packagers can optionally ship a precompiled CSS for offline styling. - **Metasploit integration** Added default Metasploit discovery via Rapid7’s modules_metadata_base.json with conditional caching. Only modules whose references contain the exact CVE ID are counted. - **Bug fixes & compatibility** ## [25. February 2025] - Version 0.13.0 - **Google Gemini, xAI Grok & DeepSeek Integration** Added support for multiple AI providers in risk assessment. Users can now choose between OpenAI ChatGPT, Google Gemini, Grok AI or DeepSeek via the new `--ai` option. - **Local CVE Database Update & Cloning** Implemented update (`--local`) functionality for the CVE List V5 repository. SploitScan now clones (or pulls updates from) the full CVE List V5 repository locally. - **Keyword-Based CVE Search Across Sources** Enhanced the search functionality to allow users to search for keywords via `--keywords` (e.g., "Apple") across both the local CVE database and remote sources (CISA and Nuclei Templates). All matching CVEs are automatically looked up by SploitScan to search for associated exploits. - **Fast Mode for Streamlined Output** Introduced a fast mode (`--fast-mode`) that limits the output to only basic CVE information, bypassing additional lookups (such as public exploits, EPSS, and risk assessments) for quicker results. ## [26. January 2025] - Version 0.12.0 - **CVSS Parsing Enhancements** Updated the `extract_cvss_info()` function to handle a broader range of CVSS fields: checks for CVSSv4.0, v3.1, v3.0, and v3 in that order, and then falls back to ADP entries if necessary. - **Date Parsing Unification** Introduced a new `parse_iso_date()` helper. Replaced direct `datetime.fromisoformat()` calls throughout the code with this function for consistent date formatting, including error handling for trailing Z characters. - **VulnCheck Key Handling** Improved error handling for the VulnCheck API key checkβ€”now returns a clearer error message if no VulnCheck key is configured. - **HTML Report Template Overhaul** Updated and reformatted the HTML export template for improved readability and consistency. Enhanced the layout for displaying references, exploit details, and the AI-powered risk assessment. Moved to a more standardized code style. - **Refined Public Exploits Display** Enhanced how exploit PoCs are sorted and displayed. - **Dependency Upgrades** Updated `requests` (2.32.2 β†’ 2.32.3), `jinja2` (3.1.4 β†’ 3.1.5), and `openai` (1.30.2 β†’ 1.60.1) in `requirements.txt`. - **General Code Cleanup** - Organized imports and method parameters for clarity (e.g., specifying `params=` in all relevant requests). - Tweaked debug output for loading the configuration file, making it more verbose and consistent. - Adjusted logic for selecting public exploits to be clearer and more maintainable. ## [05. September 2024] - Version 0.11.0 - **Method Selection Added**: Introduced a new `-m` argument to allow users to selectively run specific methods (e.g., `cisa`, `epss`, `hackerone`, `ai`, `prio`, `references`). This enables more granular control over which data sources and assessments are retrieved for each CVE. - **Import List Auto-Detection**: Added functionality to automatically detect and handle plain text CVE lists when using the `-i` option without specifying an import type (`-t`). If the file is detected as a plain text CVE list, it will import the CVE IDs directly without requiring a specific type. - **CSV Export Fix**: Fixed an issue where CISA data was not properly exported to CSV. Now, all relevant CISA information is included in the exported CSV file. - **HTML Export Fix**: Resolved an issue where `NoneType` errors caused the HTML export to fail. Improved error handling to ensure that missing or empty data does not interrupt the export process. ## [13. August 2024] - Version 0.10.5 - **General Improvements**: Prevent IndexError by checking for non-empty lists before accessing elements. ## [18. July 2024] - Version 0.10.4 - **CVE ID Export**: Fixed the display of the CVE ID not exporting in HTML. - **Enhanced CVE Retrieval**: Fixed the retrieval of missing CVE information if nested differently. ## [30. June 2024] - Version 0.10.3 - **Main Function Refactoring**: Refactored the main function into smaller, modular functions to improve maintainability and readability. - **Public Exploit Display Enhancements**: Reworked the public exploit display to include the total number of exploits and better error handling. - **Improved Error Handling**: Enhanced error handling for API key configurations and data fetching, especially for VulnCheck. ## [30. June 2024] - Version 0.10.2 - **Custom Configuration Path**: Added support for specifying a custom configuration file path using the `--config` or `-c` command-line argument. - **Platform-Specific Directories**: Added support for platform-specific (*nix, macOS, Windows) configuration directories. - **Debug Mode**: Improved debug output for configuration file loading. ## [26. June 2024] - Version 0.10 - **HackerOne Integration**: Added support for searching through HackerOne and displays if the CVE was used in any Bug Bounty program including its rank and severity distribution. - **General Improvements**: Various bug fixes. ## [24. May 2024] - Version 0.9 - **AI-Powered Risk Assessment**: Integrated OpenAI for detailed risk assessments, potential attack scenarios, mitigation recommendations, and executive summaries (needs OpenAI API key). - **CVE Information Retrieval**: Due to API rate limits and instabilities replaced NIST NVD with [CVE Program](https://github.com/CVEProject/cvelistV5). - **General Improvements**: Various bug fixes and performance improvements. ### [18. May 2024] - Version 0.8 - **HTML Export Functionality**: Introduced the ability to export vulnerability data to HTML reports. - **Packet Storm Integration**: Added support for fetching exploit data from Packet Storm. - **Enhanced Display Functions**: Added CVE_GITHUB_URL as CVE source, and functions to output the most updated CVE source. - **Code Refactoring**: Refactored code to improve maintainability and readability due to the growing code base. ## [11. May 2024] - Version 0.7 - **Nuclei Template Integration**: Added support for discovery of Nuclei templates, enhancing vulnerability data sources. - **Enhanced Display Functions**: Refined visual output across all display functions for consistency and readability. - **General Improvements**: Various bug fixes and performance improvements such as improved error handling. ## [06. May 2024] - Version 0.6.1 - **Import File Capabilities**: Added support for importing vulnerability data directly from Docker Scout scan files. ## [05. May 2024] - Version 0.6 - **Import File Capabilities**: Added support for importing vulnerability data directly from Nessus, Nexpose, and OpenVAS scan files. - **Expanded Command-Line Options**: Introduced new command-line options to specify the import file and its type. - **Robust Configuration Management**: Improved error handling for missing or malformed configuration files. - **General Improvements**: Various bug fixes and performance improvements. ## [02. March 2024] - Version 0.5 - **ExploitDB Integration**: Added support for fetching exploit data from ExploitDB. - **CVSS Enhancements**: Added support for CVSS 2 and CVSS 3.x - **Docker support** - **Code fixes** ## [28. February 2024] - Version 0.4 - **VulnCheck Integration**: Added support for fetching exploit data from VulnCheck, enhancing the exploit information available. - **API Key Configuration**: Introduced the requirement for a VulnCheck API key, specified in config.json. - **Requirements satisfied for Debian Integration** ## [17. February 2024] - Version 0.3 - **Additional Information**: Added further information such as references & vector string - **Removed**: Star count in publicly available exploits ## [15. January 2024] - Version 0.2 - **Multiple CVE Support**: Now capable of handling multiple CVE IDs in a single execution. - **JSON and CSV Export**: Added functionality to export results to JSON and CSV files. - **Enhanced CVE Display**: Improved visual differentiation and information layout for each CVE. - **Patching Priority System**: Introduced a priority rating system for patching, influenced by various factors including the availability of public exploits. ## [13th January 2024] - Version 0.1 - Initial release of SploitScan.SploitScan-0.14.3/Dockerfile000066400000000000000000000017351510166501000156510ustar00rootroot00000000000000FROM python:3.13-slim-trixie LABEL version="0.14.3" LABEL 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" ARG DEBIAN_FRONTEND=noninteractive # Setting up venv ENV VENV=/venv ENV PATH=${VENV}/bin:${PATH} # Installing packages including git RUN apt-get update && \ apt-get install --yes --no-install-recommends git && \ rm -rf /var/lib/apt/lists/* # Downloading and installing dependencies COPY ./requirements.txt . RUN python -m venv ${VENV} && \ pip install --upgrade pip setuptools && \ pip install --no-cache-dir -r requirements.txt ENV APP_HOME=/app # Copy application files WORKDIR $APP_HOME COPY ./sploitscan ./sploitscan COPY ./sploitscan.py . COPY ./LICENSE . COPY ./CHANGELOG.md . # Make a directory for scan results RUN mkdir /results # Start the application ENTRYPOINT ["python", "sploitscan.py"] CMD ["-h"] SploitScan-0.14.3/LICENSE000066400000000000000000001044711510166501000146650ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . SploitScan-0.14.3/README.md000066400000000000000000000557431510166501000151460ustar00rootroot00000000000000# SploitScan ![SPLOITSCAN-LOGO](https://github.com/xaitax/SploitScan/assets/5014849/05f6641c-2279-456f-9e5a-329926529169) ![Version](https://img.shields.io/github/v/release/xaitax/SploitScan) ![License](https://img.shields.io/github/license/xaitax/SploitScan) ## πŸ“œ 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 - πŸ“œ [Description](#-description) - 🌟 [Features](#-features) - πŸ’£ [Supported Exploit Databases](#-supported-exploit-databases) - πŸ“ [Supported Vulnerability Scanner Import](#-supported-vulnerability-scanner-import) - βš™οΈ [Installation](#️-installation) - πŸš€ [Usage](#-usage) - πŸ€– [AI-Powered Risk Assessment](#-ai-powered-risk-assessment) - πŸ›‘οΈ [Patching Priority System](#️-patching-priority-system) - πŸ«±πŸΌβ€πŸ«²πŸ½ [Contributing](#-contributing) - πŸ“Œ [Author](#-author) - πŸ“† [Changelog](#-changelog) ## 🌟 Features - **CVE Information Retrieval** Retrieve detailed information about vulnerabilities. - **EPSS Integration** Check the likelihood of exploitation with data from the Exploit Prediction Scoring System. - **Public Exploits Aggregation** Collect publicly available exploit data to help you understand the context of each vulnerability. - **CISA KEV Integration** Quickly see if a vulnerability is listed in CISA’s Known Exploited Vulnerabilities catalog. - **AI-Powered Risk Assessment** Get risk assessments using multiple AI providers (OpenAI ChatGPT, Google Gemini, Grok AI, or DeepSeek) that explain potential risks and offer mitigation ideas. - **HackerOne Reports** Find out if a vulnerability has been involved in HackerOne bug bounty reports, including basic ranking and severity details. - **Patching Priority System** Receive a simple priority rating for patching based on CVSS, EPSS, and available exploit information. - **Multi-CVE Support and Export Options** Work with multiple CVEs at once and export the results to HTML, JSON, or CSV formats. - **Vulnerability Scanner Import** Import scan results from popular vulnerability scanners (Nessus, Nexpose, OpenVAS, Docker) to directly search for known exploits. Now supports directory-based import with `--input-dir` for batch processing multiple reports. - **Granular Method Selection** Choose which specific data retrieval methods to run (such as CISA, EPSS, HackerOne, AI, etc.) so you only get the information you need. - **Local CVE Database Update & Cloning** Maintain a local copy of the CVE List V5 repository. This lets you update the full CVE data on your machine for offline use and search. - **Keyword-Based CVE Search Across Sources** Search for CVEs by keywords (for example, β€œApple”) across both your local database and remote sources like CISA and Nuclei Templates. - **Fast Mode for Streamlined Output** Use fast mode to display only the basic CVE information, skipping extra lookups for quicker results. - **User-Friendly Interface** Enjoy a clear and straightforward interface that presents all the information in an easy-to-read format. ![sploitscan_v0 10 4](https://github.com/user-attachments/assets/4f0ff4fd-9fb4-453f-92a2-f12f41714edd) ## πŸ’£ Supported Exploit Databases - **[GitHub](https://poc-in-github.motikan2010.net/)** - **[ExploitDB](https://www.exploit-db.com/)** - **[VulnCheck](https://vulncheck.com/)** (requires a **free** VulnCheck API key) - **[Nuclei](https://github.com/projectdiscovery/nuclei-templates)** - **[Metasploit](https://github.com/rapid7/metasploit-framework)** ## πŸ“ Supported Vulnerability Scanner Import - **[Nessus](https://www.tenable.com/products/nessus) (.nessus)** - **[Nexpose](https://www.rapid7.com/products/nexpose/) (.xml)** - **[OpenVAS](https://www.openvas.org/) (.xml)** - **[Docker](https://docs.docker.com/scout/) (.json)** ## βš™οΈ Installation ### GitHub ```shell git clone https://github.com/xaitax/SploitScan.git cd sploitscan pip install -r requirements.txt ``` ### pip ```shell pip install --user sploitscan ``` ### Kali/Ubuntu/Debian (might not the latest version) ```shell apt install sploitscan ``` ### Obtaining API Keys - **VulnCheck**: Sign up for a free account at [VulnCheck](https://vulncheck.com/) to get your API key. - **OpenAI**: Create an account and get an API key at [OpenAI](https://platform.openai.com/signup/). - **Google Gemini**: Create an account and get an API key at [Google AI Studio](https://aistudio.google.com/app/apikey). - **xAI Grok**: Create an account and get an API key at [xAI](https://x.ai/api). - **DeepSeek**: Create an account and get an API key at [DeepSeek](https://platform.deepseek.com/api_keys). ### Configuration File SploitScan searches for a `config.json` in multiple locations by default. It will load the first valid file it finds, in this order: 1. **Custom path passed via `--config` or `-c`** 2. **Environment variable**: `SPLOITSCAN_CONFIG_PATH` 3. **Local and standard config-file locations**: - Current working directory - `~/.sploitscan/config.json` - `~/.config/sploitscan/config.json` - `~/Library/Application Support/sploitscan/config.json` (macOS) - `%APPDATA%/sploitscan/config.json` (Windows) - `/etc/sploitscan/config.json` > **Note**: Only one file is loaded β€” the first one found in the above sequence. You can place your `config.json` in any of these paths. A typical `config.json` might look like this: ```json { "vulncheck_api_key": "", "openai_api_key": "", "google_ai_api_key": "", "grok_api_key": "", "deepseek_api_key": "" } ``` ## πŸš€ Usage ```shell $ python .\sploitscan.py -h β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• v0.14.0 / Alexander Hagenah / @xaitax / ah@primepage.de usage: sploitscan.py [-h] [-e {json,csv,html}] [-t {nessus,nexpose,openvas,docker}] [--ai {openai,google,grok,deepseek}] [-k KEYWORDS [KEYWORDS ...]] [-local] [-f] [-m METHODS] [-i IMPORT_FILE] [-c CONFIG] [-d] [cve_ids ...] SploitScan: Retrieve and display vulnerability and exploit data for specified CVE ID(s). positional arguments: cve_ids Enter one or more CVE IDs (e.g., CVE-YYYY-NNNNN). This is optional if an import file is provided via -i. options: -h, --help show this help message and exit -e {json,csv,html}, --export {json,csv,html} Export the results in the specified 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'). --ai {openai,google,grok,deepseek} Select the AI provider for risk assessment (e.g., 'openai', 'google', 'grok', or 'deepseek'). -k KEYWORDS [KEYWORDS ...], --keywords KEYWORDS [KEYWORDS ...] Search for CVEs related to specific keywords (e.g., product name). -local, --local-database Download the cvelistV5 repository into the local directory. Use the local database over online research if available. -f, --fast-mode Enable fast mode: only display basic CVE information without fetching additional exploits or data. -m METHODS, --methods METHODS Specify which methods to run, separated by commas (e.g., 'cisa,epss,hackerone,ai,prio,references'). -i IMPORT_FILE, --import-file IMPORT_FILE Path to an import file. When provided, positional CVE IDs can be omitted. The file should be a plain text list with one CVE per line. --input-dir INPUT_DIR Path to a directory containing vulnerability reports to scan for CVE IDs. -c CONFIG, --config CONFIG Path to a custom configuration file. -d, --debug Enable debug output. ``` ### Single CVE Query ```bash sploitscan CVE-2024-1709 ``` ### Multiple CVE Query ```bash sploitscan CVE-2024-1709 CVE-2024-21413 ``` ### Local CVE Database Update You can now update (or initially clone) the full CVE List V5 repository locally by using the `--local` option. Note that this repository is several GB in size, so the download may take a while. For example: ```bash sploitscan -local β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• v0.14.0 / Alexander Hagenah / @xaitax / ah@primepage.de πŸ“₯ Cloning CVE List V5 into 'C:\Users\ah/.sploitscan\cvelistV5'. ⚠️ Warning: The repository is several GB in size and the download may take a while. πŸ”„ Progress: 100.00% - 940.62 MiB | 4.97 MiB/s βœ… CVE List V5 cloned successfully. ``` ### Keyword-Based Search Across Sources Search for CVEs by keywords (e.g., "Apple") across the local database, CISA, and Nuclei Templates. > [!TIP] > This can replace more or less replace [searchsploit](https://www.exploit-db.com/searchsploit) as [ExploitDB](https://www.exploit-db.com/) isn't regularly updated anymore. ```bash sploitscan -k "Outlook Express" β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• v0.14.0 / Alexander Hagenah / @xaitax / ah@primepage.de β”Œβ”€β”€β”€[ πŸ•΅οΈ Searching local database for keywords: outlook express ] Processing CVE files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 282372/282372 [04:38<00:00, 1013.92it/s] ╔═══════════════════════════════════════════╗ β•‘ Found 48 CVE(s) matching: Outlook Express β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• CVE-1999-0967, CVE-1999-1016, CVE-1999-1033, CVE-2000-0036, CVE-2000-0105, CVE-2000-0415, CVE-2000-0524, CVE-2000-0567, CVE-2000-0621, CVE-2000-0653, CVE-2001-0145, CVE-2001-0149, CVE-2001-0945, CVE-2001-0999, CVE-2001-1088, CVE-2001-1325, CVE-2001-1547, CVE-2002-0152, CVE-2002-0285, CVE-2002-0637, CVE-2002-0862, CVE-2002-1121, CVE-2002-1179, CVE-2002-2164, CVE-2002-2202, CVE-2003-0301, CVE-2003-1105, CVE-2003-1378, CVE-2004-0215, CVE-2004-0380, CVE-2004-0526, CVE-2004-2137, CVE-2004-2694, CVE-2005-1213, CVE-2005-2226, CVE-2005-4840, CVE-2006-0014, CVE-2006-2111, CVE-2006-2386, CVE-2006-2766, CVE-2007-2225, CVE-2007-2227, CVE-2007-3897, CVE-2007-4040, CVE-2008-1448, CVE-2008-5424, CVE-2010-0816, CVE-2024-1187 ╔═══════════════════════╗ β•‘ CVE ID: CVE-2001-1547 β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• β”Œβ”€β”€β”€[ πŸ” Vulnerability information ] | β”œ Published: 2005-07-14 β”œ Base Score: N/A (N/A) β”œ Vector: N/A β”” Description: Outlook Express 6.0, with "Do not allow attachments to be saved or opened that could potentially be a virus" enabled, does not block email attachments from forwarded messages, which could allow remote attackers to execute arbitrary code. [...] ``` ### Fast Mode Enable fast mode to only display basic CVE information (skipping additional lookups). ```bash sploitscan CVE-2024-1709 --fast-mode ``` ### Import from Vulnerability Scanner Specify the type: 'nessus', 'nexpose', 'openvas', or 'docker' and provide the file path. ```bash sploitscan --import-file path/to/yourfile.nessus --type nessus ``` ### Import from Directory Scan an entire directory recursively for vulnerability reports and extract CVE IDs from all files. ```bash sploitscan --input-dir path/to/reports/directory ``` ### Select Specific Methods To run only specific data retrieval methods (e.g., CISA, EPSS, AI risk assessment), use the `-m` argument: ```bash sploitscan CVE-2024-1709 -m cisa,epss ``` ### Export Results Specify the export format: 'json', 'csv', or 'html'. ```bash sploitscan CVE-2024-1709 -e html ``` ### Docker Ensure you have Docker installed. For installation instructions, see [Docker's official installation guide](https://docs.docker.com/get-docker/). To build and run SploitScan in Docker: ```shell docker build -t sploitscan . docker run --rm sploitscan CVE-2024-1709 ``` With a volume mounted from the current directory #### Windows (Powershell) ```shell docker run -v ${PWD}:/app --rm sploitscan CVE-2024-1709 -e JSON ``` #### Linux ```shell docker run -v $(pwd):/app --rm sploitscan CVE-2024-1709 -e JSON ``` ## πŸ€– AI-Powered Risk Assessment Select an AI provider for risk assessment (OpenAI ChatGPT, Google Gemini, Grok AI and DeepSeek). 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 ```text $ sploitscan.py --ai openai 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](https://github.com/TURROKS/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! Whether it's fixing bugs, adding new features, or improving the documentation, feel free to fork the repository and submit a pull request. You can also report issues or suggest enhancements through the GitHub issue tracker. Special thanks to: - [UjjwalBudha](https://github.com/UjjwalBudha) for ideas & code - [hexwreaker](https://github.com/hexwreaker) for ideas & code - [Nilsonfsilva](https://github.com/Nilsonfsilva) for support on Debian packaging. - [bcoles](https://github.com/bcoles) for bugfixes. - [Javier Álvarez](https://github.com/jalvarezz13) for bugfixes. - [Romullo](https://github.com/Romullo) for ideas & suggestions. - [davidfortytwo](https://github.com/davidfortytwo) for enhancements (Updated CVE retrieval and PacketStorm addition). - [con-f-use](https://github.com/con-f-use) for support and fixes with setuptools/PyPi. - [Martijn Russchen](https://github.com/martijnrusschen) for his feedback and idea on HackerOne GraphQL. - [diwskx](https://github.com/diwskx) for the directory import feature and Docker improvements. - [Manuel Sommer](https://github.com/manuel-sommer) for improving the patching prioritization calculation as well as adding Dependabot. ## πŸ“Œ Author ### Alexander Hagenah - [URL](https://primepage.de) - [Twitter](https://twitter.com/xaitax) - [LinkedIn](https://www.linkedin.com/in/alexhagenah) ## πŸ“† Changelog For a detailed list of updates, fixes, and new features, check the [Changelog](CHANGELOG.md). SploitScan-0.14.3/docs/000077500000000000000000000000001510166501000146015ustar00rootroot00000000000000SploitScan-0.14.3/docs/sploitscan.1000066400000000000000000000455001510166501000170460ustar00rootroot00000000000000.TH SploitScan 1 "Version 0.12.0" "SploitScan user manual" .SH NAME \fBSploitScan\fP - A tool to fetch and display vulnerability information and public exploits for given CVE IDs. .PP .SH πŸ“œ Description .PP 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. .SH πŸ“– Table of contents .RS .IP \(bu 2 πŸ“œ Description \[la]#-description\[ra] .IP \(bu 2 🌟 Features \[la]#-features\[ra] .IP \(bu 2 πŸ’£ Supported Exploit Databases \[la]#-supported-exploit-databases\[ra] .IP \(bu 2 πŸ“ Supported Vulnerability Scanner Import \[la]#-supported-vulnerability-scanner-import\[ra] .IP \(bu 2 βš™οΈ Installation \[la]#️-installation\[ra] .IP \(bu 2 πŸš€ Usage \[la]#-usage\[ra] .IP \(bu 2 πŸ€– AI\-Powered Risk Assessment \[la]#-ai-powered-risk-assessment\[ra] .IP \(bu 2 πŸ›‘οΈ Patching Priority System \[la]#️-patching-priority-system\[ra] .IP \(bu 2 πŸ“† Changelog \[la]#-changelog\[ra] .IP \(bu 2 πŸ«±πŸΌβ€πŸ«²πŸ½ Contributing \[la]#-contributing\[ra] .IP \(bu 2 πŸ“Œ Author \[la]#-author\[ra] .IP \(bu 2 πŸ“š References \[la]#-references\[ra] .RE .SH 🌟 Features .RS .IP \(bu 2 \fBCVE Information Retrieval\fP: Fetches CVE details from the National Vulnerability Database. .IP \(bu 2 \fBEPSS Integration\fP: Includes Exploit Prediction Scoring System (EPSS) data, offering a probability score for the likelihood of CVE exploitation, aiding in prioritization. .IP \(bu 2 \fBPublic Exploits Aggregation\fP: Gathers publicly available exploits, enhancing the understanding of vulnerabilities. .IP \(bu 2 \fBCISA KEV\fP: Shows if the CVE has been listed in the Known Exploited Vulnerabilities (KEV) of CISA. .IP \(bu 2 \fBAI\-Powered Risk Assessment\fP: Leverages OpenAI to provide detailed risk assessments, potential attack scenarios, mitigation recommendations, and executive summaries. .IP \(bu 2 \fBHackerOne Reports\fP: Shows if the CVE was used within HackerOne Bug Bounty programs including their total rank overall and severity distribution. .IP \(bu 2 \fBPatching Priority System\fP: Evaluates and assigns a priority rating for patching based on various factors including public exploits availability. .IP \(bu 2 \fBMulti\-CVE Support and Export Options\fP: Supports multiple CVEs in a single run and allows exporting the results to HTML, JSON and CSV formats. .IP \(bu 2 \fBVulnerability Scanner Import\fP: Import vulnerability scans from popular vulnerability scanners and search directly for known exploits. .IP \(bu 2 \fBUser\-Friendly Interface\fP: Easy to use, providing clear and concise information. .IP \(bu 2 \fBComprehensive Security Tool\fP: Ideal for quick security assessments and staying informed about recent vulnerabilities. .RE .SH πŸ’£ Supported Exploit Databases .RS .IP \(bu 2 \fBGitHub \[la]https://poc-in-github.motikan2010.net/\[ra]\fP .IP \(bu 2 \fBExploitDB \[la]https://www.exploit-db.com/\[ra]\fP .IP \(bu 2 \fBVulnCheck \[la]https://vulncheck.com/\[ra]\fP (requires a \fBfree\fP VulnCheck API key) .IP \(bu 2 \fBPacket Storm \[la]https://packetstormsecurity.com/\[ra]\fP .IP \(bu 2 \fBNuclei \[la]https://github.com/projectdiscovery/nuclei-templates\[ra]\fP .RE .SH πŸ“ Supported Vulnerability Scanner Import .RS .IP \(bu 2 \fBNessus \[la]https://www.tenable.com/products/nessus\[ra] (.nessus)\fP .IP \(bu 2 \fBNexpose \[la]https://www.rapid7.com/products/nexpose/\[ra] (.xml)\fP .IP \(bu 2 \fBOpenVAS \[la]https://www.openvas.org/\[ra] (.xml)\fP .IP \(bu 2 \fBDocker \[la]https://docs.docker.com/scout/\[ra] (.json)\fP .RE .SH βš™οΈ Installation .SS GitHub .PP .RS .nf git clone https://github.com/xaitax/SploitScan.git cd sploitscan pip install \-r requirements.txt .fi .RE .SS pip .PP .RS .nf pip install \-\-user sploitscan .fi .RE .SS Kali/Ubuntu/Debian .PP .RS .nf apt install sploitscan .fi .RE .SS Configuration File .PP Create a \fB\fCconfig.json\fR file in one of the following locations with your API keys: .RS .IP \(bu 2 Current directory .IP \(bu 2 \fB\fC~/.sploitscan/\fR .IP \(bu 2 \fB\fC~/.config/sploitscan/\fR .IP \(bu 2 \fB\fC/etc/sploitscan/\fR .RE .PP .RS .nf { "vulncheck_api_key": "your_vulncheck_api_key", "openai_api_key": "your_openai_api_key" } .fi .RE .SH πŸš€ Usage .PP .RS .nf $ sploitscan.py \-h β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• v0.10.1 / Alexander Hagenah / @xaitax / ah@primepage.de usage: sploitscan.py [\-h] [\-e {json,JSON,csv,CSV,html,HTML}] [\-t {nessus,nexpose,openvas,docker}] [\-i IMPORT_FILE] [\-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 \-n 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. \-d, \-\-debug Enable debug output. .fi .RE .SS Single CVE Query .PP .RS .nf sploitscan CVE\-2024\-1709 .fi .RE .SS Multiple CVE Query .PP .RS .nf sploitscan CVE\-2024\-1709 CVE\-2024\-21413 .fi .RE .SS Import from Vulnerability Scanner .PP Specify the type: 'nessus', 'nexpose', 'openvas', or 'docker' and provide the file path. .PP .RS .nf sploitscan \-\-import\-file path/to/yourfile.nessus \-\-type nessus .fi .RE .SS Export Results .PP Specify the export format: 'json', 'csv', or 'html'. .PP .RS .nf sploitscan CVE\-2024\-1709 \-e html .fi .RE .SS Docker .PP .RS .nf docker build \-t sploitscan . docker run \-\-rm sploitscan CVE\-2024\-1709 .fi .RE .PP With a volume mounted from the current directory .SS Windows (Powershell) .PP .RS .nf docker run \-v ${PWD}:/app \-\-rm sploitscan CVE\-2024\-1709 \-e JSON .fi .RE .SS Linux .PP .RS .nf docker run \-v $(pwd):/app \-\-rm sploitscan CVE\-2024\-1709 \-e JSON .fi .RE .SH πŸ€– AI\-Powered Risk Assessment .PP SploitScan integrates with OpenAI to provide a comprehensive AI\-powered risk assessment for each CVE. This feature includes: .RS .IP \(bu 2 Detailed Risk Assessment: Understand the nature of the vulnerability and its business impact. .IP \(bu 2 Potential Attack Scenarios: Get descriptions of potential attack scenarios leveraging the vulnerability. .IP \(bu 2 Mitigation Recommendations: Receive specific, actionable recommendations to mitigate the risk. .IP \(bu 2 Executive Summary: A concise summary accessible to non\-technical stakeholders, highlighting the business impact and urgency. .RE .SS Example output .PP .RS .nf $ 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. | └──────────────────────────────────────── .fi .RE .SH πŸ›‘οΈ Patching Priority System .PP 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 \[la]https://github.com/TURROKS/CVE_Prioritizer\[ra], with enhancements for handling publicly available exploits. Here's how it works: .RS .IP \(bu 2 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. .IP \(bu 2 A to D Priority: Based on a combination of CVSS scores and EPSS probability percentages. The decision matrix is as follows: .RS .IP \(bu 2 A: CVSS score >= 6.0 and EPSS score >= 0.2. High severity with a significant probability of exploitation. .IP \(bu 2 B: CVSS score >= 6.0 but EPSS score < 0.2. High severity but lower probability of exploitation. .IP \(bu 2 C: CVSS score < 6.0 and EPSS score >= 0.2. Lower severity but higher probability of exploitation. .IP \(bu 2 D: CVSS score < 6.0 and EPSS score < 0.2. Lower severity and lower probability of exploitation. .RE .RE .PP 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. .SH πŸ“† Changelog .SS [26. June 2024] \- Version 0.10 .RS .IP \(bu 2 \fBHackerOne Integration\fP: Added support for searching through HackerOne and displays if the CVE was used in any Bug Bounty program including its rank and severity distribution. .IP \(bu 2 \fBGeneral Improvements\fP: Various bug fixes. .RE .SS [24. May 2024] \- Version 0.9 .RS .IP \(bu 2 \fBAI\-Powered Risk Assessment\fP: Integrated OpenAI for detailed risk assessments, potential attack scenarios, mitigation recommendations, and executive summaries (needs OpenAI API key). .IP \(bu 2 \fBCVE Information Retrieval\fP: Due to API rate limits and instabilities replaced NIST NVD with CVE Program \[la]https://github.com/CVEProject/cvelistV5\[ra]\&. .IP \(bu 2 \fBGeneral Improvements\fP: Various bug fixes and performance improvements. .RE .SS [18. May 2024] \- Version 0.8 .RS .IP \(bu 2 \fBHTML Export Functionality\fP: Introduced the ability to export vulnerability data to HTML reports. .IP \(bu 2 \fBPacket Storm Integration\fP: Added support for fetching exploit data from Packet Storm. .IP \(bu 2 \fBEnhanced Display Functions\fP: Added CVE\fIGITHUB\fPURL as CVE source, and functions to output the most updated CVE source. .IP \(bu 2 \fBCode Refactoring\fP: Refactored code to improve maintainability and readability due to the growing code base. .RE .SS [11. May 2024] \- Version 0.7 .RS .IP \(bu 2 \fBNuclei Template Integration\fP: Added support for discovery of Nuclei templates, enhancing vulnerability data sources. .IP \(bu 2 \fBEnhanced Display Functions\fP: Refined visual output across all display functions for consistency and readability. .IP \(bu 2 \fBGeneral Improvements\fP: Various bug fixes and performance improvements such as improved error handling. .RE .SS [06. May 2024] \- Version 0.6.1 .RS .IP \(bu 2 \fBImport File Capabilities\fP: Added support for importing vulnerability data directly from Docker Scout scan files. .RE .SS [05. May 2024] \- Version 0.6 .RS .IP \(bu 2 \fBImport File Capabilities\fP: Added support for importing vulnerability data directly from Nessus, Nexpose, and OpenVAS scan files. .IP \(bu 2 \fBExpanded Command\-Line Options\fP: Introduced new command\-line options to specify the import file and its type. .IP \(bu 2 \fBRobust Configuration Management\fP: Improved error handling for missing or malformed configuration files. .IP \(bu 2 \fBGeneral Improvements\fP: Various bug fixes and performance improvements. .RE .SS [02. March 2024] \- Version 0.5 .RS .IP \(bu 2 \fBExploitDB Integration\fP: Added support for fetching exploit data from ExploitDB. .IP \(bu 2 \fBCVSS Enhancements\fP: Added support for CVSS 2 and CVSS 3.x .IP \(bu 2 \fBDocker support\fP .IP \(bu 2 \fBCode fixes\fP .RE .SS [28. February 2024] \- Version 0.4 .RS .IP \(bu 2 \fBVulnCheck Integration\fP: Added support for fetching exploit data from VulnCheck, enhancing the exploit information available. .IP \(bu 2 \fBAPI Key Configuration\fP: Introduced the requirement for a VulnCheck API key, specified in config.json. .IP \(bu 2 \fBRequirements satisfied for Debian Integration\fP .RE .SS [17. February 2024] \- Version 0.3 .RS .IP \(bu 2 \fBAdditional Information\fP: Added further information such as references & vector string .IP \(bu 2 \fBRemoved\fP: Star count in publicly available exploits .RE .SS [15. January 2024] \- Version 0.2 .RS .IP \(bu 2 \fBMultiple CVE Support\fP: Now capable of handling multiple CVE IDs in a single execution. .IP \(bu 2 \fBJSON and CSV Export\fP: Added functionality to export results to JSON and CSV files. .IP \(bu 2 \fBEnhanced CVE Display\fP: Improved visual differentiation and information layout for each CVE. .IP \(bu 2 \fBPatching Priority System\fP: Introduced a priority rating system for patching, influenced by various factors including the availability of public exploits. .RE .SS [13th January 2024] \- Version 0.1 .RS .IP \(bu 2 Initial release of SploitScan. .RE .SH πŸ«±πŸΌβ€πŸ«²πŸ½ Contributing .PP Contributions are welcome. Please feel free to fork, modify, and make pull requests or report issues. .PP Special thanks to: .RS .IP \(bu 2 Nilsonfsilva \[la]https://github.com/Nilsonfsilva\[ra] for support on Debian packaging. .IP \(bu 2 bcoles \[la]https://github.com/bcoles\[ra] for bugfixes. .IP \(bu 2 Javier Álvarez \[la]https://github.com/jalvarezz13\[ra] for bugfixes. .IP \(bu 2 Romullo \[la]https://github.com/Romullo\[ra] for ideas & suggestions. .IP \(bu 2 davidfortytwo \[la]https://github.com/davidfortytwo\[ra] for enhancements (Updated CVE retrieval and PacketStorm addition). .IP \(bu 2 con\-f\-use \[la]https://github.com/con-f-use\[ra] for support and fixes with setuptools/PyPi. .IP \(bu 2 Martijn Russchen \[la]https://github.com/martijnrusschen\[ra] for his feedback and idea on HackerOne GraphQL. .RE .SH πŸ“Œ Author .SS Alexander Hagenah .RS .IP \(bu 2 URL \[la]https://primepage.de\[ra] .IP \(bu 2 Twitter \[la]https://twitter.com/xaitax\[ra] .IP \(bu 2 LinkedIn \[la]https://www.linkedin.com/in/alexhagenah\[ra] .RE .SH πŸ“š References .RS .IP \(bu 2 CISA Known Exploited Vulnerabilities Catalog \[la]https://www.cisa.gov/known-exploited-vulnerabilities-catalog\[ra] .IP \(bu 2 CVE Program \[la]https://github.com/CVEProject/cvelistV5\[ra] .IP \(bu 2 ExploitDB \[la]https://www.exploit-db.com/\[ra] .IP \(bu 2 FIRST EPSS \[la]https://www.first.org/epss/api\[ra] .IP \(bu 2 HackerOne \[la]https://hackerone.com/\[ra] .IP \(bu 2 nomi\-sec PoC\-in\-GitHub API \[la]https://poc-in-github.motikan2010.net/\[ra] .IP \(bu 2 OpenAI \[la]https://openai.com/\[ra] .IP \(bu 2 Packet Storm \[la]https://packetstormsecurity.com/\[ra] .IP \(bu 2 ProjectDiscovery Nuclei \[la]https://github.com/projectdiscovery/nuclei-templates\[ra] .IP \(bu 2 VulnCheck \[la]https://vulncheck.com/\[ra] .RE SploitScan-0.14.3/pyproject.toml000066400000000000000000000020221510166501000165610ustar00rootroot00000000000000[build-system] requires = ["setuptools>=65", "wheel"] build-backend = "setuptools.build_meta" [project] name = "sploitscan" version = "0.14.3" description = "SploitScan is a cybersecurity utility designed to provide detailed information on vulnerabilities and associated exploits." authors = [ { name = "Alexander Hagenah", email = "ah@primepage.de" } ] license = { file = "LICENSE" } dynamic = [ "readme" ] dependencies = [ "requests==2.32.5", "jinja2==3.1.6", "openai==2.6.1", "google-genai==1.47.0", "GitPython==3.1.45", "tqdm==4.67.1" ] requires-python = ">=3.8" [project.scripts] sploitscan = "sploitscan.sploitscan:cli" [project.urls] homepage = "https://github.com/xaitax/SploitScan" repository = "https://github.com/xaitax/SploitScan" documentation = "https://github.com/xaitax/SploitScan#readme" changelog = "https://github.com/xaitax/SploitScan" [tool.setuptools] dynamic.readme = { file = [ "README.md" ], content-type = "text/markdown" } package-data.sploitscan = [ "templates/*.html", "config.json" ] SploitScan-0.14.3/requirements.txt000066400000000000000000000001411510166501000171310ustar00rootroot00000000000000requests==2.32.5 jinja2==3.1.6 openai==2.6.1 google-genai==1.47.0 GitPython==3.1.45 tqdm==4.67.1 SploitScan-0.14.3/sploitscan.py000066400000000000000000000001441510166501000164010ustar00rootroot00000000000000#!/usr/bin/env python3 from sploitscan.sploitscan import cli if __name__ == "__main__": cli() SploitScan-0.14.3/sploitscan/000077500000000000000000000000001510166501000160305ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/__init__.py000066400000000000000000000003111510166501000201340ustar00rootroot00000000000000from __future__ import annotations # Public package API and metadata from .constants import VERSION as __version__ from .cli import cli, main __all__ = [ "__version__", "cli", "main", ] SploitScan-0.14.3/sploitscan/__main__.py000066400000000000000000000001021510166501000201130ustar00rootroot00000000000000from .sploitscan import cli if __name__ == "__main__": cli() SploitScan-0.14.3/sploitscan/ai.py000066400000000000000000000110761510166501000170000ustar00rootroot00000000000000""" AI orchestration: prompt generation and provider routing. """ from __future__ import annotations import json from typing import Any, Dict, Optional from .config import load_config from .ai_providers.openai_provider import get_openai_risk_assessment # Other providers (Google/Grok/DeepSeek) are imported lazily inside get_risk_assessment() # to keep optional dependencies graceful and avoid import errors if packages are not installed. def generate_ai_prompt(cve_details: str, cve_data: Dict[str, Any]) -> str: """ Build a deterministic, hallucination-resistant prompt. We: - Force exactly four numbered sections with strict formatting. - Emphasize evidential reasoning using provided data (CVE, KEV, EPSS, exploits). - Forbid inventing patches/links and require stating β€œUnknown” if uncertain. - Optimize for security triage usefulness (business impact + concrete actions). """ prompt = f""" You are a senior security analyst. Using ONLY the information provided below, produce EXACTLY four sections, each starting with the numeric header shown: 1. Risk Assessment Explain: vulnerability nature, affected components (if clear), preconditions, attacker effort, and impact on confidentiality, integrity, and availability. Reflect signals like CVSS/EPSS, CISA KEV status, public exploit presence (GitHub, Metasploit, Exploit‑DB, Nuclei) where available. If data is unclear, write β€œUnknown”. 2. Potential Attack Scenarios Describe at least one plausible end-to-end scenario: entry point, pre-auth vs post-auth, privilege required, lateral movement, and realistic outcomes (e.g., data theft, RCE, business downtime). If multiple paths exist, choose the highest-risk one and justify briefly. 3. Mitigation Recommendations Provide concrete, prioritized actions. Include: patch/update guidance if a vendor fix is referenced, interim mitigations (network controls, feature disablement, WAF rules, config hardening), and detection/monitoring ideas. Only cite links that are present in the provided references; do NOT invent URLs. If patch availability is unclear, say β€œPatch status: Unknown”. 4. Executive Summary Give a concise, two-paragraph summary for non-technical stakeholders: business risk, exploitation likelihood, and urgency. End with a clear call to action. Strict formatting rules: - Plain text only. No bullet points, no dashes, no markdown, no emojis. - Each of the four headings must appear verbatim on its own line as above. - Separate paragraphs with a single blank line. - Do not add extra sections or a conclusion beyond the four sections. - If you are unsure, write β€œUnknown” rather than speculating. CVE DETAILS: {cve_details} FULL CVE DATA (for reference; use cautiously, do not copy raw JSON): {json.dumps(cve_data, indent=2)} """ return prompt def get_risk_assessment( ai_provider: Optional[str], cve_details: str, cve_data: Dict[str, Any], *, config: Optional[Dict[str, Any]] = None, ) -> str: """ Route the prompt to the selected AI provider. If no provider is selected, return an explanatory message. """ if not ai_provider: return "❌ No AI provider selected." cfg = config or load_config() prompt = generate_ai_prompt(cve_details, cve_data) # Normalize common aliases normalized = { "openai": "openai", "chatgpt": "openai", "gpt": "openai", "google": "google", "gemini": "google", "grok": "grok", "xai": "grok", "deepseek": "deepseek", } provider = normalized.get(ai_provider.lower(), ai_provider.lower()) if provider == "openai": return get_openai_risk_assessment(prompt, cfg.get("openai_api_key")) if provider == "google": try: from .ai_providers.google_provider import get_google_risk_assessment except Exception as e: return f"❌ Google provider not available: {e}" return get_google_risk_assessment(prompt, cfg.get("google_ai_api_key")) if provider == "grok": try: from .ai_providers.grok_provider import get_grok_risk_assessment except Exception as e: return f"❌ Grok provider not available: {e}" return get_grok_risk_assessment(prompt, cfg.get("grok_api_key")) if provider == "deepseek": try: from .ai_providers.deepseek_provider import get_deepseek_risk_assessment except Exception as e: return f"❌ DeepSeek provider not available: {e}" return get_deepseek_risk_assessment(prompt, cfg.get("deepseek_api_key")) return "❌ Unknown AI provider selected." SploitScan-0.14.3/sploitscan/ai_providers/000077500000000000000000000000001510166501000205165ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/ai_providers/deepseek_provider.py000066400000000000000000000033721510166501000245740ustar00rootroot00000000000000""" DeepSeek provider for AI-powered risk assessment. """ from __future__ import annotations from typing import Optional import time from openai import OpenAI # type: ignore[import-untyped] def get_deepseek_risk_assessment(prompt: str, api_key: Optional[str]) -> str: """ DeepSeek via OpenAI-compatible API. - Endpoint: https://api.deepseek.com - Model: deepseek-chat - Deterministic output: temperature=0, stream=False - Retries: simple backoff to tolerate transient timeouts """ if not api_key: return "❌ DeepSeek API key is not configured correctly." try: client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com") except Exception as e: return f"❌ Error initializing DeepSeek client: {e}" last_err: Optional[str] = None for attempt in range(3): try: response = client.chat.completions.create( model="deepseek-chat", messages=[ {"role": "system", "content": "You are a security analyst."}, {"role": "user", "content": prompt}, ], temperature=0, stream=False, timeout=60, ) if response.choices and len(response.choices) > 0: message = response.choices[0].message content = getattr(message, "content", None) return (content or str(message) or "").strip() return "DeepSeek: No response received." except Exception as e: last_err = str(e) if attempt < 2: time.sleep(3 * (attempt + 1)) continue return f"❌ Error fetching data from DeepSeek: {last_err or 'Unknown error'}" SploitScan-0.14.3/sploitscan/ai_providers/google_provider.py000066400000000000000000000022511510166501000242560ustar00rootroot00000000000000""" Google Gemini provider for AI-powered risk assessment. """ from __future__ import annotations import time from typing import Optional from google import genai # type: ignore[import-untyped] def get_google_risk_assessment(prompt: str, api_key: Optional[str]) -> str: if not api_key: return "❌ Google AI API key is not configured correctly." client = genai.Client(api_key=api_key) # retry a couple of times similar to legacy behavior for attempt in range(3): try: response = client.models.generate_content( model="gemini-2.0-flash", contents=[prompt], generation_config={ "temperature": 0, "top_p": 0.9 }, ) if hasattr(response, "text"): return (response.text or "").strip() return "Google AI: AI analysis failed." except Exception as e: if attempt < 2: print(f"⚠️ Google AI Timeout (Attempt {attempt + 1}/3), retrying...") time.sleep(5) else: return f"❌ Error fetching data from Google AI: {e}" SploitScan-0.14.3/sploitscan/ai_providers/grok_provider.py000066400000000000000000000030611510166501000237440ustar00rootroot00000000000000""" xAI Grok provider for AI-powered risk assessment. """ from __future__ import annotations from typing import Optional import time from openai import OpenAI # type: ignore[import-untyped] def get_grok_risk_assessment(prompt: str, api_key: Optional[str]) -> str: if not api_key: return "❌ Grok AI API key is not configured correctly." try: client = OpenAI(api_key=api_key, base_url="https://api.x.ai/v1") except Exception as e: return f"❌ Error initializing Grok client: {e}" last_err: Optional[str] = None for attempt in range(3): try: response = client.chat.completions.create( model="grok-4-latest", messages=[ {"role": "system", "content": "You are a security analyst."}, {"role": "user", "content": prompt}, ], temperature=0, stream=False, timeout=60, # allow more time; xAI can be slower than OpenAI defaults ) if response.choices and len(response.choices) > 0: message = response.choices[0].message content = getattr(message, "content", None) return (content or str(message) or "").strip() return "Grok AI: No response received." except Exception as e: last_err = str(e) if attempt < 2: time.sleep(3 * (attempt + 1)) continue return f"❌ Error fetching data from Grok AI: {last_err or 'Unknown error'}" SploitScan-0.14.3/sploitscan/ai_providers/openai_provider.py000066400000000000000000000030201510166501000242500ustar00rootroot00000000000000""" OpenAI provider for AI-powered risk assessment. """ from __future__ import annotations from typing import Optional import time from openai import OpenAI # type: ignore[import-untyped] def get_openai_risk_assessment(prompt: str, api_key: Optional[str]) -> str: """ OpenAI Chat Completions with deterministic settings and simple retries. - Model: gpt-4o (can be adjusted later) - temperature=0, stream=False - timeout=60 - retries with incremental backoff """ if not api_key: return "❌ OpenAI API key is not configured correctly." try: client = OpenAI(api_key=api_key) except Exception as e: return f"❌ Error initializing OpenAI client: {e}" last_err: Optional[str] = None for attempt in range(3): try: response = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": "You are a security analyst."}, {"role": "user", "content": prompt}, ], temperature=0, stream=False, timeout=60, ) content = response.choices[0].message.content if response.choices else None return (content or "").strip() except Exception as e: last_err = str(e) if attempt < 2: time.sleep(3 * (attempt + 1)) continue return f"❌ Error fetching data from OpenAI: {last_err or 'Unknown error'}" SploitScan-0.14.3/sploitscan/cli.py000066400000000000000000000341351510166501000171570ustar00rootroot00000000000000#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations import argparse from typing import Any, Dict, List, Optional from .constants import VERSION, BLUE, GREEN, YELLOW, ENDC from .config import load_config from .paths import get_cve_local_dir from .display import ( display_banner, print_cve_header, display_cve_data, display_epss_score, display_cisa_status, display_public_exploits, display_hackerone_data, display_cve_references, display_priority_rating, display_ai_risk_assessment, ) from .fetchers.cve import fetch_cve_from_github, load_cve_from_local from .fetchers.epss import fetch_epss_score from .fetchers.cisa import fetch_cisa_data, extract_cve_entry from .fetchers.nuclei import fetch_nuclei_data from .fetchers.vulncheck import fetch_vulncheck_data from .fetchers.exploitdb import fetch_exploitdb_data from .fetchers.github_poc import fetch_github_pocs from .fetchers.hackerone import fetch_hackerone_cve_details from .fetchers.metasploit import fetch_metasploit_modules_for_cve from .metrics import calculate_priority from .compose import compile_cve_details from .ai import get_risk_assessment from .repo import clone_cvelistV5_repo from .search import search_cve_by_keywords from .importers import import_vulnerability_data, import_vulnerability_data_from_dir from .exporters.html_exporter import export_to_html from .exporters.json_exporter import export_to_json from .exporters.csv_exporter import export_to_csv def _configure_console_encoding() -> None: """ Ensure stdout/stderr can emit UTF-8 on Windows consoles to avoid UnicodeEncodeError. Falls back silently if reconfigure is unavailable. """ try: import sys if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8", errors="replace") sys.stderr.reconfigure(encoding="utf-8", errors="replace") except Exception: pass def _ensure_cve_loaded(cve_id: str, *, fast_mode: bool, config: Dict[str, Any]) -> Optional[Dict[str, Any]]: """ Load CVE JSON either from local DB (fast path) or from GitHub. """ cve_data: Optional[Dict[str, Any]] = None if fast_mode: cve_data, _ = load_cve_from_local(cve_id, config=config) if cve_data: return cve_data # Fallback: fetch from GitHub cve_data, _ = fetch_cve_from_github(cve_id) return cve_data def _public_exploits_bundle(cve_id: str, *, config: Dict[str, Any], cve_data: Dict[str, Any]) -> Dict[str, Any]: github_data, _ = fetch_github_pocs(cve_id) # Fallback: if PoC-in-GitHub API returns nothing, derive GitHub entries from CVE references # Use strict URL parsing and host allow‑list to avoid substring-based checks. if not (github_data and isinstance(github_data, dict) and github_data.get("pocs")): try: from urllib.parse import urlparse refs = (cve_data or {}).get("containers", {}).get("cna", {}).get("references", []) fallback: list[dict] = [] allowed_hosts = { "github.com", "www.github.com", "gist.github.com", "raw.githubusercontent.com", } for ref in refs or []: url = (ref or {}).get("url", "") try: parsed = urlparse(url) host = (parsed.hostname or "").lower() scheme_ok = parsed.scheme in {"http", "https"} if scheme_ok and host in allowed_hosts: fallback.append({"html_url": url, "created_at": "N/A"}) except Exception: # Ignore malformed URLs continue if fallback: github_data = {"pocs": fallback} except Exception: # best-effort only pass vulncheck_data, vulncheck_error = fetch_vulncheck_data(cve_id, config=config) exploitdb_data, _ = fetch_exploitdb_data(cve_id) nuclei_data, _ = fetch_nuclei_data(cve_id) metasploit_data, _ = fetch_metasploit_modules_for_cve(cve_id) display_public_exploits( github_data=github_data, vulncheck_data=vulncheck_data if isinstance(vulncheck_data, dict) else {}, exploitdb_data=exploitdb_data, nuclei_data=nuclei_data, metasploit_data=metasploit_data, vulncheck_error=vulncheck_error, ) return { "github_data": github_data, "vulncheck_data": vulncheck_data if isinstance(vulncheck_data, dict) else {}, "exploitdb_data": exploitdb_data, "packetstorm_data": {}, "nuclei_data": nuclei_data, "metasploit_data": metasploit_data, "vulncheck_error": vulncheck_error, } def _selected(methods: Optional[str]) -> set[str]: default_methods = {"cisa", "epss", "hackerone", "ai", "prio", "references"} if not methods: return default_methods return {m.strip().lower() for m in methods.split(",") if m.strip()} def main( cve_ids: List[str], *, export_format: Optional[str] = None, import_file: Optional[str] = None, import_type: Optional[str] = None, ai_provider: Optional[str] = None, config_path: Optional[str] = None, methods: Optional[str] = None, debug: bool = False, fast_mode: bool = False, input_dir: Optional[str] = None, ) -> None: """ Orchestrate SploitScan workflow for one or more CVE IDs. """ config = load_config(config_path=config_path, debug=debug) all_results: List[Dict[str, Any]] = [] selected = _selected(methods) # Normalize export format if export_format: export_format = export_format.lower() # Optional import if import_file: imported_ids = import_vulnerability_data(import_file, import_type) if not imported_ids: print("❌ No valid CVE IDs found in the provided file.") return cve_ids = imported_ids if input_dir: imported_ids_from_dir = import_vulnerability_data_from_dir(input_dir) if not imported_ids_from_dir: print("❌ No valid CVE IDs found in the provided directory.") return cve_ids = imported_ids_from_dir if not cve_ids: print("❌ No CVE IDs provided. Please provide CVE IDs or an import file.") return for raw in cve_ids: cve_id = str(raw).upper() print_cve_header(cve_id) # Load core CVE data cve_data = _ensure_cve_loaded(cve_id, fast_mode=fast_mode, config=config) display_cve_data(cve_data, None if cve_data else "❌ Unable to load CVE data") if not cve_data: # Skip to next CVE if core data missing continue # Fast mode: basic info only if fast_mode: cve_result = { "CVE Data": cve_data, "EPSS Data": None, "CISA Data": {"cisa_status": "N/A", "ransomware_use": "N/A"}, "Nuclei Data": None, "GitHub Data": None, "VulnCheck Data": None, "ExploitDB Data": None, "PacketStorm Data": {}, "HackerOne Data": None, "Priority": {"Priority": 0}, "Risk Assessment": None, } all_results.append(cve_result) continue # Public exploits pub = _public_exploits_bundle(cve_id, config=config, cve_data=cve_data) # EPSS epss_data = None if "epss" in selected: epss_data, _ = fetch_epss_score(cve_id) display_epss_score(epss_data, None) # CISA relevant_cisa_data = {"cisa_status": "N/A", "ransomware_use": "N/A"} if "cisa" in selected: cisa_data, cisa_err = fetch_cisa_data() display_cisa_status(cve_id, cisa_data, cisa_err) entry = extract_cve_entry(cve_id, cisa_data) if entry: relevant_cisa_data = { "cisa_status": entry.get("cisa_status", "N/A"), "ransomware_use": entry.get("ransomware_use", "N/A"), } # HackerOne hackerone_data = None if "hackerone" in selected: hackerone_data, hacker_err = fetch_hackerone_cve_details(cve_id) display_hackerone_data(hackerone_data, hacker_err) # AI risk assessment risk_assessment = None if "ai" in selected and ai_provider: details = compile_cve_details(cve_id, cve_data, epss_data, relevant_cisa_data, pub) # closure for provider call (lazy execution inside display with spinner) def _fetch_ai(): return get_risk_assessment(ai_provider, details, cve_data, config=config) # display_ai_risk_assessment now returns the assessment text risk_assessment = display_ai_risk_assessment(details, cve_data, ai_provider, _fetch_ai) # Priority priority = None if "prio" in selected: priority = calculate_priority( cve_id=cve_id, cve_data=cve_data, epss_data=epss_data, github_data=pub.get("github_data"), cisa_data=(None if "cisa" not in selected else {"vulnerabilities": [extract_cve_entry(cve_id, fetch_cisa_data()[0])]}), vulncheck_data=pub.get("vulncheck_data"), exploitdb_data=pub.get("exploitdb_data"), ) display_priority_rating(cve_id, priority) # References if "references" in selected: display_cve_references(cve_data) cve_result = { "CVE Data": cve_data, "EPSS Data": epss_data, "CISA Data": relevant_cisa_data, "Nuclei Data": pub.get("nuclei_data"), "GitHub Data": pub.get("github_data"), "VulnCheck Data": pub.get("vulncheck_data"), "ExploitDB Data": pub.get("exploitdb_data"), "Metasploit Data": pub.get("metasploit_data"), "PacketStorm Data": {}, # removed; keep for template compatibility "HackerOne Data": hackerone_data, "Priority": {"Priority": priority}, "Risk Assessment": risk_assessment, } all_results.append(cve_result) # Exports if export_format == "json": filename = export_to_json(all_results, cve_ids) print(f"β”Œβ”€β”€β”€[ πŸ“ JSON Export ]\n|\nβ”” Data exported to file: {filename}\n") elif export_format == "csv": filename = export_to_csv(all_results, cve_ids) print(f"β”Œβ”€β”€β”€[ πŸ“ CSV Export ]\n|\nβ”” Data exported to file: {filename}\n") elif export_format == "html": try: filename = export_to_html(all_results, cve_ids) print(f"β”Œβ”€β”€β”€[ πŸ“ HTML Export ]\n|\nβ”” Data exported to file: {filename}\n") except FileNotFoundError as e: print(f"β”Œβ”€β”€β”€[ πŸ“ HTML Export ]\n|\nβ”” {e}\n") def cli() -> None: _configure_console_encoding() display_banner() parser = argparse.ArgumentParser( description="SploitScan: Retrieve and display vulnerability and exploit data for specified CVE ID(s)." ) parser.add_argument( "cve_ids", type=str, nargs="*", default=[], help="Enter one or more CVE IDs (e.g., CVE-YYYY-NNNNN). This is optional if an import file is provided via -i.", ) parser.add_argument( "-e", "--export", choices=["json", "csv", "html"], help="Export the results in the specified format ('json', 'csv', or 'html').", ) parser.add_argument( "-t", "--type", choices=["nessus", "nexpose", "openvas", "docker"], help="Specify the type of the import file ('nessus', 'nexpose', 'openvas', or 'docker').", ) parser.add_argument( "--ai", type=str, choices=["openai", "google", "grok", "deepseek"], help="Select the AI provider for risk assessment (e.g., 'openai', 'google', 'grok', or 'deepseek').", ) parser.add_argument( "-k", "--keywords", type=str, nargs="+", help="Search for CVEs related to specific keywords (e.g., product name).", ) parser.add_argument( "-local", "--local-database", dest="local_database", action="store_true", help="Download the cvelistV5 repository into the local directory. Use the local database over online research if available.", ) parser.add_argument( "-f", "--fast-mode", dest="fast_mode", action="store_true", help="Enable fast mode: only display basic CVE information without fetching additional exploits or data.", ) parser.add_argument( "-m", "--methods", type=str, help="Specify which methods to run, separated by commas (e.g., 'cisa,epss,hackerone,ai,prio,references').", ) parser.add_argument( "-i", "--import-file", type=str, help="Path to an import file. When provided, positional CVE IDs can be omitted. The file should be a plain text list with one CVE per line.", ) parser.add_argument( "--input-dir", type=str, help="Path to a directory containing vulnerability reports to scan for CVE IDs.", ) parser.add_argument("-c", "--config", type=str, help="Path to a custom configuration file.") parser.add_argument("-d", "--debug", action="store_true", help="Enable debug output.") args = parser.parse_args() if args.local_database: cfg = load_config(config_path=args.config, debug=args.debug) clone_cvelistV5_repo(config=cfg) if args.keywords: cve_ids = search_cve_by_keywords(args.keywords) if not cve_ids: raise SystemExit("No valid CVE IDs found for the provided keywords.") else: cve_ids = args.cve_ids main( cve_ids, export_format=args.export, import_file=args.import_file, import_type=args.type, ai_provider=args.ai, config_path=args.config, methods=args.methods, debug=args.debug, fast_mode=args.fast_mode, input_dir=args.input_dir, ) SploitScan-0.14.3/sploitscan/compose.py000066400000000000000000000073731510166501000200610ustar00rootroot00000000000000from __future__ import annotations from typing import Any, Dict, Optional def compile_cve_details( cve_id: str, cve_data: Dict[str, Any], epss_data: Optional[Dict[str, Any]], relevant_cisa_data: Optional[Dict[str, Any]], public_exploits: Dict[str, Any], ) -> str: published = cve_data.get("cveMetadata", {}).get("datePublished", "N/A") if cve_data else "N/A" description = ( next( ( desc.get("value", "") for desc in cve_data.get("containers", {}).get("cna", {}).get("descriptions", []) if desc.get("lang") == "en" ), "No description available", ) .replace("\n\n", " ") .replace(" ", " ") if cve_data else "No description available" ) # CVSS info (stringly typed here; caller may use metrics.extract_cvss_info elsewhere) base_score = "N/A" base_severity = "N/A" vector_string = "N/A" try: containers = cve_data.get("containers", {}) cna = containers.get("cna", {}) metrics = cna.get("metrics", []) if metrics: cvss = ( metrics[0].get("cvssV4_0") or metrics[0].get("cvssV3_1") or metrics[0].get("cvssV3_0") or metrics[0].get("cvssV3") ) if cvss: base_score = str(cvss.get("baseScore", "N/A")) base_severity = str(cvss.get("baseSeverity", "N/A")) vector_string = str(cvss.get("vectorString", "N/A")) except Exception: pass epss_score = ( epss_data.get("data", [{}])[0].get("epss", "N/A") if epss_data and isinstance(epss_data, dict) and epss_data.get("data") else "N/A" ) cisa_status = relevant_cisa_data.get("cisa_status", "N/A") if relevant_cisa_data else "N/A" ransomware_use = relevant_cisa_data.get("ransomware_use", "N/A") if relevant_cisa_data else "N/A" github_exploits = ( "\n".join( [ f"{poc.get('created_at', 'N/A')}: {poc.get('html_url', 'N/A')}" for poc in (public_exploits.get("github_data") or {}).get("pocs", []) ] ) if public_exploits.get("github_data") else "N/A" ) vulncheck_exploits = ( "\n".join( [ f"{xdb.get('date_added', 'N/A')}: " f"{(xdb.get('clone_ssh_url', '') or '').replace('git@github.com:', 'https://github.com/').replace('.git', '')}" for item in (public_exploits.get("vulncheck_data") or {}).get("data", []) for xdb in item.get("vulncheck_xdb", []) ] ) if public_exploits.get("vulncheck_data") else "N/A" ) packetstorm_url = (public_exploits.get("packetstorm_data") or {}).get("packetstorm_url", "N/A") nuclei_url = ( f"https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/{(public_exploits.get('nuclei_data') or {}).get('file_path')}" if public_exploits.get("nuclei_data") and (public_exploits.get("nuclei_data") or {}).get("file_path") else "N/A" ) references_list = ( cve_data.get("containers", {}).get("cna", {}).get("references", []) if cve_data else [] ) references = "\n".join([ref.get("url", "") for ref in references_list]) if references_list else "N/A" return f""" Published: {published} Base Score: {base_score} ({base_severity}) Vector: {vector_string} Description: {description} EPSS Score: {epss_score} CISA Status: {cisa_status} Ransomware Use: {ransomware_use} GitHub Exploits: {github_exploits} VulnCheck Exploits: {vulncheck_exploits} PacketStorm URL: {packetstorm_url} Nuclei Template: {nuclei_url} Further References: {references} """ SploitScan-0.14.3/sploitscan/config.json000066400000000000000000000002101510166501000201610ustar00rootroot00000000000000{ "vulncheck_api_key": "", "openai_api_key": "", "google_api_key": "", "grok_api_key": "", "deepseek_api_key": "" } SploitScan-0.14.3/sploitscan/config.py000066400000000000000000000102241510166501000176460ustar00rootroot00000000000000""" Configuration loading and normalization for SploitScan. - Discovers config.json from multiple standard locations - Supports environment override via SPLOITSCAN_CONFIG_PATH - Normalizes legacy key names (e.g., google_api_key -> google_ai_api_key) - Returns a plain dict for compatibility with existing code paths """ from __future__ import annotations import json import os from typing import Any, Dict, Optional, Tuple _DEFAULT_CONFIG: Dict[str, Any] = { "vulncheck_api_key": None, "openai_api_key": None, "google_ai_api_key": None, "grok_api_key": None, "deepseek_api_key": None, "local_database_dir": None, } def _debug_print(enabled: bool, msg: str) -> None: if enabled: print(msg) def _candidate_config_paths(explicit_path: Optional[str]) -> Tuple[str, ...]: paths = [] if explicit_path: paths.append(explicit_path) env_path = os.getenv("SPLOITSCAN_CONFIG_PATH") if env_path: paths.append(env_path) # Module directory default: sploitscan/config.json if shipped within package module_dir = os.path.dirname(os.path.abspath(__file__)) paths.append(os.path.join(module_dir, "config.json")) # User-level defaults paths.extend( [ os.path.expanduser("~/.sploitscan/config.json"), os.path.expanduser("~/.config/sploitscan/config.json"), os.path.expanduser("~/Library/Application Support/sploitscan/config.json"), # macOS os.path.join(os.getenv("APPDATA", ""), "sploitscan", "config.json"), # Windows "/etc/sploitscan/config.json", ] ) # Remove empties / duplicates, preserve order seen = set() uniq = [] for p in paths: if p and p not in seen: uniq.append(p) seen.add(p) return tuple(uniq) def _normalize_keys(cfg: Dict[str, Any]) -> Dict[str, Any]: """ Normalize legacy or alternative keys to modern schema: - google_api_key -> google_ai_api_key """ norm = dict(cfg) if "google_ai_api_key" not in norm and "google_api_key" in norm: norm["google_ai_api_key"] = norm.get("google_api_key") return norm def _merge_with_defaults(cfg: Dict[str, Any]) -> Dict[str, Any]: merged = dict(_DEFAULT_CONFIG) merged.update(cfg or {}) return merged def load_config(config_path: Optional[str] = None, debug: bool = False) -> Dict[str, Any]: """ Load configuration as a dict with standardized keys and defaults applied. Search order: 1) Explicit --config path if provided 2) SPLOITSCAN_CONFIG_PATH env var 3) sploitscan/config.json (within package directory) 4) ~/.sploitscan/config.json 5) ~/.config/sploitscan/config.json 6) ~/Library/Application Support/sploitscan/config.json (macOS) 7) %APPDATA%/sploitscan/config.json (Windows) 8) /etc/sploitscan/config.json Returns: dict: merged configuration with defaults and normalized keys. """ for path in _candidate_config_paths(config_path): if os.path.isfile(path): _debug_print(debug, f"Trying config file: {path}") try: with open(path, "r", encoding="utf-8") as f: cfg = json.load(f) _debug_print(debug, f"Successfully loaded config file: {path}") cfg = _normalize_keys(cfg) return _merge_with_defaults(cfg) except json.JSONDecodeError as e: print(f"⚠️ JSON parsing error in {path}: {e}") except Exception as e: print(f"⚠️ Unexpected error reading {path}: {e}") print("⚠️ Config file not found in any checked locations, using default settings.") return dict(_DEFAULT_CONFIG) def get(key: str, default: Any = None, *, config: Optional[Dict[str, Any]] = None) -> Any: """ Helper to retrieve a value from an explicitly passed config or the environment-driven defaults. Prefer passing the config returned by load_config() through your call chain. """ if config is None: # Fall back to defaults without file lookup to avoid repeated IO. return _DEFAULT_CONFIG.get(key, default) return config.get(key, default) SploitScan-0.14.3/sploitscan/constants.py000066400000000000000000000022061510166501000204160ustar00rootroot00000000000000""" Centralized constants for SploitScan. """ from typing import Dict # Version VERSION: str = "0.14.3" # ANSI Colors BLUE: str = "\033[94m" GREEN: str = "\033[92m" YELLOW: str = "\033[93m" ENDC: str = "\033[0m" # URLs and API endpoints CVE_GITHUB_URL: str = "https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves" EPSS_API_URL: str = "https://api.first.org/data/v1/epss?cve={cve_id}" CISA_URL: str = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json" NUCLEI_URL: str = "https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/cves.json" GITHUB_API_URL: str = "https://poc-in-github.motikan2010.net/api/v1/" VULNCHECK_API_URL: str = "https://api.vulncheck.com/v3/index/vulncheck-kev" EXPLOITDB_URL: str = "https://gitlab.com/exploit-database/exploitdb/-/raw/main/files_exploits.csv?ref_type=heads" HACKERONE_URL: str = "https://hackerone.com/graphql" # Thresholds CVSS_THRESHOLD: float = 6.0 EPSS_THRESHOLD: float = 0.2 # Priority color mapping PRIORITY_COLORS: Dict[str, str] = { "A+": "\033[91m", "A": "\033[31m", "B": "\033[93m", "C": "\033[94m", "D": "\033[92m", } SploitScan-0.14.3/sploitscan/display.py000066400000000000000000000346031510166501000200550ustar00rootroot00000000000000""" Terminal display helpers to keep the original UI and formatting intact. """ from __future__ import annotations import itertools import sys import textwrap import threading import time from typing import Any, Dict, Iterable, List, Optional, Tuple from .constants import BLUE, GREEN, YELLOW, ENDC, PRIORITY_COLORS, VERSION from .metrics import extract_cvss_info from .utils import parse_iso_date def display_banner() -> None: banner = f""" {BLUE} β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β• v{VERSION} / Alexander Hagenah / @xaitax / ah@primepage.de {ENDC} """ print(banner) def print_cve_header(cve_id: str) -> None: header = f" CVE ID: {cve_id} " line = "═" * len(header) print(f"{GREEN}β•”{line}β•—{ENDC}") print(f"{GREEN}β•‘{header}β•‘{ENDC}") print(f"{GREEN}β•š{line}╝{ENDC}\n") def _display_section(title: str, lines: Iterable[str]) -> None: print(f"β”Œβ”€β”€β”€[ {BLUE}{title}{ENDC} ]") print("|") any_line = False for ln in lines: print(ln) any_line = True if not any_line: print(f"β”” ❌ No data found.") print() def _wrap_desc(text: str) -> str: wrapped = text.replace("\n\n", " ").replace(" ", " ") return textwrap.fill(wrapped, width=100, subsequent_indent=" " * 15) def display_cve_data(cve_data: Optional[Dict[str, Any]], error: Optional[str] = None) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if error: return [f"β”” {error}"] if not data or "containers" not in data or "cna" not in data["containers"]: return ["β”” ❌ No vulnerability data found."] cve_item = data["containers"]["cna"] published = data.get("cveMetadata", {}).get("datePublished", "") published = parse_iso_date(published) if published else "" description = next( ( desc.get("value", "") for desc in cve_item.get("descriptions", []) if desc.get("lang") == "en" ), "No description available", ) wrapped_description = _wrap_desc(description) base_score, base_severity, vector_string = extract_cvss_info(data) out = [ f"β”œ Published: {published}", f"β”œ Base Score: {base_score} ({base_severity})", f"β”œ Vector: {vector_string}", f"β”” Description: {wrapped_description}", ] return out _display_section("πŸ” Vulnerability information", template(cve_data)) def display_epss_score(epss_data: Optional[Dict[str, Any]], error: Optional[str] = None) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if error: return [f"β”” {error}"] if not data or "data" not in data or not data["data"]: return ["β”” ❌ No data found."] try: epss_score = float(data["data"][0].get("epss", 0)) return [f"β”” EPSS Score: {epss_score * 100:.2f}% Probability of exploitation."] except Exception: return ["β”” ❌ No data found."] _display_section("♾️ Exploit Prediction Score (EPSS)", template(epss_data)) def display_cisa_status(cve_id: str, cisa_data: Optional[Dict[str, Any]], error: Optional[str] = None) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if error: return [f"β”” {error}"] if not data or "vulnerabilities" not in data: return ["β”” ❌ No data found."] for v in data.get("vulnerabilities", []): if v.get("cveID") == cve_id: cisa_status = v.get("cisa_status", "N/A") ransomware_use = v.get("ransomware_use", "N/A") return [f"β”œ Listed: {cisa_status}", f"β”” Ransomware: {ransomware_use}"] return ["β”” ❌ No data found."] _display_section("πŸ›‘οΈ CISA KEV Catalog", template(cisa_data)) def display_public_exploits( github_data: Optional[Dict[str, Any]], vulncheck_data: Optional[Dict[str, Any]], exploitdb_data: Optional[List[Dict[str, Any]]], nuclei_data: Optional[Dict[str, Any]], metasploit_data: Optional[Dict[str, Any]] = None, vulncheck_error: Optional[str] = None, ) -> None: def template() -> Tuple[List[str], int]: total_exploits = 0 entries: List[str] = [] # GitHub if github_data and github_data.get("pocs"): entries.append("β”œ GitHub") sorted_pocs = sorted(github_data["pocs"], key=lambda x: x.get("created_at", ""), reverse=True) for poc in sorted_pocs: url = poc.get("html_url", "N/A") entries.append(f"β”‚ β”œ {url}") total_exploits += 1 if entries: entries[-1] = entries[-1].replace("β”œ", "β””") # VulnCheck if vulncheck_data and isinstance(vulncheck_data, dict) and vulncheck_data.get("data"): entries.append("β”‚") entries.append("β”œ VulnCheck") sorted_vulncheck = sorted( (xdb for item in vulncheck_data["data"] for xdb in item.get("vulncheck_xdb", [])), key=lambda x: x.get("date_added", ""), reverse=True, ) for xdb in sorted_vulncheck: github_url = xdb.get("clone_ssh_url", "").replace("git@github.com:", "https://github.com/").replace( ".git", "" ) entries.append(f"β”‚ β”œ {github_url}") total_exploits += 1 if entries: entries[-1] = entries[-1].replace("β”œ", "β””") if vulncheck_error: entries.append("β”‚") entries.append(f"β”” ❌ VulnCheck Error: {vulncheck_error}") # Exploit-DB if exploitdb_data: entries.append("β”‚") entries.append("β”œ Exploit-DB") sorted_exploitdb = sorted(exploitdb_data, key=lambda x: x.get("date", ""), reverse=True) for item in sorted_exploitdb: url = f"https://www.exploit-db.com/exploits/{item['id']}" entries.append(f"β”‚ β”œ {url}") total_exploits += 1 if entries: entries[-1] = entries[-1].replace("β”œ", "β””") # Metasploit if metasploit_data and isinstance(metasploit_data, dict) and metasploit_data.get("modules"): entries.append("β”‚") entries.append("β”œ Metasploit") for m in metasploit_data.get("modules", []): if not isinstance(m, dict): continue fullname = m.get("fullname", "N/A") rank_label = m.get("rank_label") or "" label = f"{fullname} [{rank_label}]" if rank_label else fullname url = m.get("url") or "" if url: entries.append(f"β”‚ β”œ {url}") else: entries.append(f"β”‚ β”œ {label}") total_exploits += 1 if entries: entries[-1] = entries[-1].replace("β”œ", "β””") # Nuclei if nuclei_data and (nuclei_data.get("file_path") or nuclei_data.get("raw_url")): entries.append("β”‚") entries.append("β”œ Nuclei") url = nuclei_data.get("raw_url") if not url and nuclei_data.get("file_path"): base_url = "https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/" url = f"{base_url}{nuclei_data['file_path']}" if url: entries.append(f"β”‚ β”œ {url}") total_exploits += 1 if entries: entries[-1] = entries[-1].replace("β”œ", "β””") if not entries: return (["β”” ❌ No data found."], total_exploits) return (entries, total_exploits) exploits, total = template() print(f"β”Œβ”€β”€β”€[ {BLUE}πŸ’£ Public Exploits (Total: {total}){ENDC} ]") if exploits: print("|") for line in exploits: print(line) print() else: print("|") print(f"β”” ❌ No data found.\n") def display_hackerone_data(hackerone_data: Optional[Dict[str, Any]], error: Optional[str] = None) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if error: return [f"β”” {error}"] if not data or "data" not in data or "cve_entry" not in data["data"]: return ["β”” ❌ No data found."] cve_entry = data["data"].get("cve_entry") if not cve_entry: return ["β”” ❌ No data found."] rank = cve_entry.get("rank", "N/A") reports_submitted_count = cve_entry.get("reports_submitted_count", "N/A") severity_unknown = cve_entry.get("severity_count_unknown", 0) severity_none = cve_entry.get("severity_count_none", 0) severity_low = cve_entry.get("severity_count_low", 0) severity_medium = cve_entry.get("severity_count_medium", 0) severity_high = cve_entry.get("severity_count_high", 0) severity_critical = cve_entry.get("severity_count_critical", 0) severity_display = ( f"Unknown: {severity_unknown} / None: {severity_none} / Low: {severity_low} / " f"Medium: {severity_medium} / High: {severity_high} / Critical: {severity_critical}" ) return [f"β”œ Rank: {rank}", f"β”œ Reports: {reports_submitted_count}", f"β”” Severity: {severity_display}"] _display_section("πŸ•΅οΈ HackerOne Hacktivity", template(hackerone_data)) def display_cve_references(cve_data: Optional[Dict[str, Any]], error: Optional[str] = None) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if error: return [f"β”” {error}"] if not data or "containers" not in data or "cna" not in data["containers"]: return ["β”” ❌ No data found."] refs = data["containers"]["cna"].get("references", []) if refs: lines = [f"β”œ {ref.get('url')}" for ref in refs[:-1]] lines.append(f"β”” {refs[-1].get('url')}") return lines return ["β”” ❌ No further references found."] _display_section("πŸ“š Further References", template(cve_data)) def display_priority_rating(cve_id: str, priority: Optional[str]) -> None: def template(data: Optional[Dict[str, Any]]) -> List[str]: if not data or "priority" not in data or not data["priority"]: return ["β”” ❌ No data found."] priority_color = PRIORITY_COLORS.get(data["priority"], ENDC) return [f"β”” Priority: {priority_color}{data['priority']}{ENDC}"] if priority is None: _display_section("⚠️ Patching Priority Rating", template(None)) else: _display_section("⚠️ Patching Priority Rating", template({"priority": priority})) def display_ai_risk_assessment(cve_details: str, cve_data: Dict[str, Any], ai_provider: str, fetch_fn) -> None: """ Render the AI risk assessment with a spinner. fetch_fn: Callable[[str], str] - a function that returns the assessment text for a given prompt. This indirection avoids tight coupling to specific providers in the display layer. """ # Spinner using an Event (no globals) stop_event = threading.Event() def spinner_animation(message: str) -> None: spinner = itertools.cycle(["|", "/", "-", "\\"]) while not stop_event.is_set(): sys.stdout.write(f"\r{message} {next(spinner)}") sys.stdout.flush() time.sleep(0.1) sys.stdout.write("\r" + " " * (len(message) + 2) + "\r") sys.stdout.flush() assessment: Optional[str] = None def get_assessment(): nonlocal assessment try: assessment = fetch_fn() except Exception as e: assessment = f"❌ Error fetching AI response: {e}" finally: stop_event.set() print("β”Œβ”€β”€β”€[ πŸ€– AI-Powered Risk Assessment ]") print("|") spinner_thread = threading.Thread(target=spinner_animation, args=(f"| Loading {ai_provider} risk assessment...",)) spinner_thread.start() worker_thread = threading.Thread(target=get_assessment) worker_thread.start() worker_thread.join() spinner_thread.join() print("|") if assessment: sections = assessment.split("\n\n") for section in sections: section = section.strip() if not section: continue if section.startswith(("1. ", "2. ", "3. ", "4. ")): header = section.split("\n")[0].strip() print(f"| {header}") print("| " + "-" * (len(header) + 1)) content = "\n".join(section.split("\n")[1:]).strip() wrapped_content = textwrap.fill(content, width=100, initial_indent="| ", subsequent_indent="| ") print(wrapped_content) else: wrapped_content = textwrap.fill(section, width=100, initial_indent="| ", subsequent_indent="| ") print(wrapped_content) print("|") else: print("| ❌ No AI Risk Assessment could be retrieved.") print("|") print("└────────────────────────────────────────\n") return assessment or "" SploitScan-0.14.3/sploitscan/exporters/000077500000000000000000000000001510166501000200635ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/exporters/csv_exporter.py000066400000000000000000000027271510166501000231700ustar00rootroot00000000000000from __future__ import annotations import csv from typing import Any, Dict, List from ..utils import generate_filename def export_to_csv(all_results: List[Dict[str, Any]], cve_ids: List[str]) -> str: """ Export the results to a CSV file. Behavior mirrors legacy exporter: - Fieldnames are derived from the first item's keys plus "Risk Assessment". - Rows are written as-is; nested structures will be stringified by csv module. """ if not all_results: filename = generate_filename(cve_ids, "csv") with open(filename, "w", newline="", encoding="utf-8") as f: writer = csv.writer(f) writer.writerow(["CVE Data", "EPSS Data", "CISA Data", "Nuclei Data", "GitHub Data", "VulnCheck Data", "ExploitDB Data", "PacketStorm Data", "HackerOne Data", "Priority", "Risk Assessment"]) return filename filename = generate_filename(cve_ids, "csv") keys = list(all_results[0].keys()) if "Risk Assessment" not in keys: keys = keys + ["Risk Assessment"] with open(filename, "w", newline="", encoding="utf-8") as f: writer = csv.DictWriter(f, fieldnames=keys) writer.writeheader() for item in all_results: # ensure key exists for writer if "Risk Assessment" not in item: item["Risk Assessment"] = item.get("Risk Assessment", "N/A") writer.writerow(item) return filename SploitScan-0.14.3/sploitscan/exporters/html_exporter.py000066400000000000000000000131171510166501000233340ustar00rootroot00000000000000from __future__ import annotations import os from typing import Any, Dict, List from jinja2 import Environment, FileSystemLoader from ..utils import datetimeformat, generate_filename from ..metrics import extract_cvss_info def _handle_cvss(results: List[Dict[str, Any]]) -> List[Dict[str, Any]]: for result in results: # GitHub PoCs github_pocs = 0 gd = result.get("GitHub Data") or {} if isinstance(gd, dict): pocs = gd.get("pocs") or [] if isinstance(pocs, list): github_pocs = len(pocs) else: pocs = [] # VulnCheck XDBs vulncheck_count = 0 vd = result.get("VulnCheck Data") or {} if isinstance(vd, dict): vc_items = vd.get("data") or [] if isinstance(vc_items, list): for item in vc_items: if isinstance(item, dict): xdb = item.get("vulncheck_xdb") or [] if isinstance(xdb, list): vulncheck_count += len(xdb) # Exploit-DB entries edb_count = 0 edb = result.get("ExploitDB Data") or [] if isinstance(edb, list): edb_count = len(edb) # Nuclei presence (count as 1 if present) nuclei_count = 0 nd = result.get("Nuclei Data") if isinstance(nd, dict) and (nd.get("file_path") or nd.get("raw_url")): nuclei_count = 1 # Metasploit modules (count all modules discovered for this CVE) metasploit_count = 0 msf = result.get("Metasploit Data") or {} if isinstance(msf, dict): mods = msf.get("modules") or [] if isinstance(mods, list): metasploit_count = len(mods) # Public Exploits Total result["Public Exploits Total"] = github_pocs + vulncheck_count + edb_count + nuclei_count + metasploit_count # Sort GitHub PoCs (by created_at desc) if present if isinstance(gd, dict) and isinstance(pocs, list) and pocs: gd["pocs"] = sorted( [x for x in pocs if isinstance(x, dict)], key=lambda x: x.get("created_at", ""), reverse=True, ) result["GitHub Data"] = gd # Sort VulnCheck XDBs (by date_added desc) if isinstance(vd, dict): vc_items = vd.get("data") or [] if isinstance(vc_items, list): for item in vc_items: if isinstance(item, dict) and isinstance(item.get("vulncheck_xdb"), list): item["vulncheck_xdb"] = sorted( [x for x in item["vulncheck_xdb"] if isinstance(x, dict)], key=lambda x: x.get("date_added", ""), reverse=True, ) vd["data"] = vc_items result["VulnCheck Data"] = vd # Sort Exploit-DB entries (by date desc) if isinstance(edb, list) and edb: result["ExploitDB Data"] = sorted( [x for x in edb if isinstance(x, dict)], key=lambda x: x.get("date", ""), reverse=True, ) # Normalize EPSS to float epss = result.get("EPSS Data") if isinstance(epss, dict): data_list = epss.get("data") if isinstance(data_list, list) and data_list: try: epss_value = float(data_list[0].get("epss", 0)) except (ValueError, TypeError): epss_value = 0.0 data_list[0]["epss"] = epss_value epss["data"] = data_list result["EPSS Data"] = epss # Normalize CVSS for HTML template convenience if ( "CVE Data" in result and isinstance(result["CVE Data"], dict) and result["CVE Data"] and "containers" in result["CVE Data"] ): base_score, base_severity, vector_string = extract_cvss_info(result["CVE Data"]) try: base_score_float = float(base_score) except (ValueError, TypeError): base_score_float = 0.0 result["CVE Data"]["cvss_info"] = { "baseScore": base_score_float, "baseSeverity": base_severity, "vectorString": vector_string, } return results def export_to_html(all_results: List[Dict[str, Any]], cve_ids: List[str]) -> str: """ Render HTML report using the bundled Jinja2 template with the original paths fallback. Returns the output filename. """ base_path = os.path.dirname(os.path.abspath(__file__)) package_root = os.path.abspath(os.path.join(base_path, os.pardir)) template_paths = [ os.path.join(package_root, "templates"), os.path.expanduser("~/.sploitscan/templates"), os.path.expanduser("~/.config/sploitscan/templates"), "/etc/sploitscan/templates", ] env: Environment for path in template_paths: if os.path.exists(os.path.join(path, "report_template.html")): env = Environment(loader=FileSystemLoader(path)) break else: raise FileNotFoundError("HTML template 'report_template.html' not found in any checked locations.") env.filters["datetimeformat"] = datetimeformat tmpl = env.get_template("report_template.html") filename = generate_filename(cve_ids, "html") output = tmpl.render(cve_data=_handle_cvss(all_results)) with open(filename, "w", encoding="utf-8") as f: f.write(output) return filename SploitScan-0.14.3/sploitscan/exporters/json_exporter.py000066400000000000000000000006651510166501000233450ustar00rootroot00000000000000from __future__ import annotations import json from typing import Any, Dict, List from ..utils import generate_filename def export_to_json(all_results: List[Dict[str, Any]], cve_ids: List[str]) -> str: """Write results to a JSON file and return the filename.""" filename = generate_filename(cve_ids, "json") with open(filename, "w", encoding="utf-8") as f: json.dump(all_results, f, indent=4) return filename SploitScan-0.14.3/sploitscan/fetchers/000077500000000000000000000000001510166501000176335ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/fetchers/cisa.py000066400000000000000000000030241510166501000211230ustar00rootroot00000000000000""" CISA KEV fetcher utilities. - Fetch the full CISA KEV JSON feed - Annotate each vulnerability with derived fields used by UI - Provide helper to extract a single CVE's relevant entry """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple from ..constants import CISA_URL from .common import fetch_json def fetch_cisa_data() -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Fetch the CISA Known Exploited Vulnerabilities JSON. On success, annotates each entry with: - cisa_status: "Yes" - ransomware_use: original knownRansomwareCampaignUse or "Unknown" Returns (json, None) or (None, error). """ data, err = fetch_json(CISA_URL) if err: return None, err if not isinstance(data, dict): return None, "❌ Unexpected data format from CISA" vulns = data.get("vulnerabilities", []) if isinstance(vulns, list): for v in vulns: if isinstance(v, dict): v["cisa_status"] = "Yes" v["ransomware_use"] = v.get("knownRansomwareCampaignUse", "Unknown") return data, None def extract_cve_entry(cve_id: str, cisa_data: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: """Return the vulnerability entry for the given CVE ID from the CISA feed (if present).""" if not cisa_data or "vulnerabilities" not in cisa_data: return None for v in cisa_data.get("vulnerabilities", []): if isinstance(v, dict) and v.get("cveID") == cve_id: return v return None SploitScan-0.14.3/sploitscan/fetchers/common.py000066400000000000000000000045011510166501000214750ustar00rootroot00000000000000""" Shared HTTP fetching utilities with consistent (data, error) return semantics. """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple, Union, Iterable import requests DEFAULT_TIMEOUT = 30 def fetch( url: str, *, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: int = DEFAULT_TIMEOUT, ) -> Tuple[Optional[requests.Response], Optional[str]]: """ Perform an HTTP GET with a timeout. Returns (response, None) on success or (None, error_message) on failure. """ try: resp = requests.get(url, params=params, headers=headers, timeout=timeout) resp.raise_for_status() return resp, None except requests.exceptions.RequestException as e: return None, f"❌ Error fetching data from {url}: {e}" def fetch_json( url: str, *, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: int = DEFAULT_TIMEOUT, ) -> Tuple[Optional[Union[Dict[str, Any], Any]], Optional[str]]: """ Fetch an endpoint and parse JSON body. Returns (json_object, None) on success or (None, error_message) on failure. """ resp, err = fetch(url, params=params, headers=headers, timeout=timeout) if err: return None, err try: return resp.json(), None # type: ignore[return-value] except ValueError as e: return None, f"❌ Error parsing JSON data from {url}: {e}" def iter_json_lines( url: str, *, params: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: int = DEFAULT_TIMEOUT, chunk_size: int = 8192, ) -> Tuple[Optional[Iterable[str]], Optional[str]]: """ Stream an endpoint that serves line-delimited JSON (NDJSON). Returns (iterator_of_lines, None) or (None, error_message). """ try: with requests.get(url, params=params, headers=headers, timeout=timeout, stream=True) as resp: resp.raise_for_status() def _line_iter(): for raw in resp.iter_lines(chunk_size=chunk_size): if raw: yield raw.decode("utf-8") return _line_iter(), None except requests.exceptions.RequestException as e: return None, f"❌ Error streaming data from {url}: {e}" SploitScan-0.14.3/sploitscan/fetchers/cve.py000066400000000000000000000041531510166501000207650ustar00rootroot00000000000000""" CVE data fetcher utilities. - Build raw GitHub URL for CVE JSON in cvelistV5 - Fetch CVE JSON from GitHub - Optionally load CVE JSON from local cloned database """ from __future__ import annotations import json import os from typing import Any, Dict, Optional, Tuple from ..constants import CVE_GITHUB_URL from ..paths import get_cve_local_dir from .common import fetch_json def _cve_path_parts(cve_id: str) -> Tuple[str, str]: """Return (year, thousand_group) for the CVE id.""" parts = cve_id.split("-") if len(parts) < 3: raise ValueError(f"Invalid CVE ID format: {cve_id}") year = parts[1] try: cve_num = int(parts[2]) except ValueError: raise ValueError(f"Invalid CVE numeric part: {cve_id}") thousand_group = f"{cve_num // 1000}xxx" return year, thousand_group def build_github_cve_url(cve_id: str) -> str: """Construct the raw GitHub URL to the CVE JSON in cvelistV5.""" year, thousand = _cve_path_parts(cve_id) return f"{CVE_GITHUB_URL}/{year}/{thousand}/{cve_id}.json" def fetch_cve_from_github(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Fetch CVE JSON from cvelistV5 raw on GitHub. Returns (json, None) or (None, error). """ url = build_github_cve_url(cve_id) return fetch_json(url) def load_cve_from_local(cve_id: str, *, config: Optional[Dict[str, Any]] = None) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Load CVE JSON from a locally cloned cvelistV5 repository if available. Returns (json, None) or (None, error). """ year, thousand = _cve_path_parts(cve_id) base = get_cve_local_dir(config) cve_path = os.path.join(base, year, thousand, f"{cve_id}.json") if not os.path.exists(cve_path): return None, f"Local CVE file not found: {cve_path}" try: with open(cve_path, "r", encoding="utf-8") as f: return json.load(f), None except json.JSONDecodeError as e: return None, f"❌ Error parsing local CVE JSON {cve_path}: {e}" except Exception as e: return None, f"❌ Error reading local CVE JSON {cve_path}: {e}" SploitScan-0.14.3/sploitscan/fetchers/epss.py000066400000000000000000000006731510166501000211650ustar00rootroot00000000000000""" EPSS fetcher utilities. """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple from ..constants import EPSS_API_URL from .common import fetch_json def fetch_epss_score(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Fetch EPSS score for a given CVE ID. Returns (json, None) or (None, error). """ url = EPSS_API_URL.format(cve_id=cve_id) return fetch_json(url) SploitScan-0.14.3/sploitscan/fetchers/exploitdb.py000066400000000000000000000027171510166501000222060ustar00rootroot00000000000000""" Exploit-DB fetcher utilities. Parses the public CSV index and filters rows that reference the given CVE in their "codes" field. Returns a simplified list of dictionaries: {"id": str, "date": str}. """ from __future__ import annotations import csv from io import StringIO from typing import Any, Dict, List, Optional, Tuple from ..constants import EXPLOITDB_URL from .common import fetch def fetch_exploitdb_data(cve_id: str) -> Tuple[List[Dict[str, str]], Optional[str]]: """ Fetch and parse the Exploit-DB CSV index, returning entries that include the CVE in the "codes" column. Returns (list_of_entries, None) or ([], error_message) """ resp, err = fetch(EXPLOITDB_URL) if err: return [], err try: decoded = resp.content.decode("utf-8") # type: ignore[attr-defined] except Exception as e: return [], f"❌ Error decoding CSV from Exploit-DB: {e}" try: reader = csv.DictReader(StringIO(decoded)) results: List[Dict[str, str]] = [] for row in reader: # Expected columns include: id, file, description, date, author, type, platform, port, codes, ... codes = (row.get("codes") or "").split(";") if cve_id in (code.strip() for code in codes): results.append({"id": row.get("id", ""), "date": row.get("date", "")}) return results, None except Exception as e: return [], f"❌ Error parsing CSV data from Exploit-DB: {e}" SploitScan-0.14.3/sploitscan/fetchers/github_poc.py000066400000000000000000000012641510166501000223330ustar00rootroot00000000000000""" GitHub PoC index fetcher. Uses the nomi-sec PoC-in-GitHub API index to retrieve PoCs for a given CVE. """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple from ..constants import GITHUB_API_URL from .common import fetch_json def fetch_github_pocs(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Fetch GitHub PoCs for the given CVE ID. API: https://poc-in-github.motikan2010.net/api/v1/?cve_id=CVE-XXXX-YYYY Returns (json, None) or (None, error) The JSON typically includes a "pocs" list with entries containing html_url and created_at. """ return fetch_json(GITHUB_API_URL, params={"cve_id": cve_id}) SploitScan-0.14.3/sploitscan/fetchers/hackerone.py000066400000000000000000000032261510166501000221470ustar00rootroot00000000000000""" HackerOne CVE details fetcher via GraphQL. Returns basic rank, reports_submitted_count, and severity distribution for a CVE. """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple import requests from ..constants import HACKERONE_URL _QUERY = """ query CveDiscoveryDetailedViewCveEntry($cve_id: String!) { cve_entry(cve_id: $cve_id) { rank reports_submitted_count severity_count_unknown severity_count_none severity_count_low severity_count_medium severity_count_high severity_count_critical __typename } } """ def fetch_hackerone_cve_details(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Perform a POST to HackerOne GraphQL API for the given CVE. Returns: (json, None) on success with "data" -or- (None, error_message) on failure """ headers = {"content-type": "application/json"} payload = { "operationName": "CveDiscoveryDetailedViewCveEntry", "variables": {"cve_id": cve_id}, "query": _QUERY, } try: resp = requests.post(HACKERONE_URL, headers=headers, json=payload, timeout=30) except requests.RequestException as e: return None, f"❌ Error fetching data from HackerOne: {e}" if resp.status_code != 200: return None, f"❌ Error fetching data from HackerOne: {resp.status_code}: {resp.text}" try: data = resp.json() except ValueError as e: return None, f"❌ Error parsing JSON data from HackerOne: {e}" if "data" in data and "cve_entry" in data["data"]: return data, None return None, "❌ No HackerOne data found for this CVE." SploitScan-0.14.3/sploitscan/fetchers/metasploit.py000066400000000000000000000175101510166501000223720ustar00rootroot00000000000000from __future__ import annotations """ Metasploit module discovery based on Rapid7's official modules_metadata_base.json. Approach: - Download modules_metadata_base.json from rapid7/metasploit-framework (raw GitHub). - Use conditional requests (ETag/Last-Modified) to avoid re-downloading when unchanged. - Build a CVE -> [ModuleInfo] index by matching CVE tokens only in the "references" field. - Expose fetch_metasploit_modules_for_cve(cve_id) to retrieve verified modules for a CVE. """ import json import os import re import time from typing import Any, Dict, List, Optional, Tuple import requests # Raw metadata URL (about ~10MB). Using master to keep it up-to-date. MSF_METADATA_URL = "https://raw.githubusercontent.com/rapid7/metasploit-framework/master/db/modules_metadata_base.json" # Cache locations CACHE_BASE_DIR = os.path.expanduser("~/.sploitscan/cache/metasploit") CACHE_JSON_PATH = os.path.join(CACHE_BASE_DIR, "modules_metadata_base.json") CACHE_META_PATH = os.path.join(CACHE_BASE_DIR, "modules_metadata_base.json.meta") DEFAULT_TIMEOUT = 30 _CVE_INDEX: Optional[Dict[str, List[Dict[str, Any]]]] = None _LAST_LOADED_ETAG: Optional[str] = None _CVE_REGEX = re.compile(r"\bCVE-\d{4}-\d{4,7}\b", re.IGNORECASE) # Mapping from MSF numeric rank to human-friendly label _RANK_LABELS = { 600: "Excellent", 500: "Great", 400: "Good", 300: "Normal", 200: "Average", 100: "Low", 0: "Manual", } def _ensure_cache_dir() -> None: os.makedirs(CACHE_BASE_DIR, exist_ok=True) def _read_meta() -> Dict[str, Any]: try: with open(CACHE_META_PATH, "r", encoding="utf-8") as f: return json.load(f) except Exception: return {} def _write_meta(meta: Dict[str, Any]) -> None: try: with open(CACHE_META_PATH, "w", encoding="utf-8") as f: json.dump(meta, f) except Exception: # Non-fatal pass def _load_cached_json() -> Optional[Dict[str, Any]]: try: if not os.path.exists(CACHE_JSON_PATH): return None with open(CACHE_JSON_PATH, "r", encoding="utf-8") as f: return json.load(f) except Exception: return None def _save_json_to_cache(data: Dict[str, Any]) -> None: try: with open(CACHE_JSON_PATH, "w", encoding="utf-8") as f: json.dump(data, f) except Exception: # Non-fatal pass def _conditional_download() -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Download the metadata JSON with conditional headers (ETag / If-Modified-Since). Returns (json, error) where json can be None if not modified (fallback to cache). """ _ensure_cache_dir() headers: Dict[str, str] = {"Accept": "application/json"} meta = _read_meta() etag = meta.get("etag") last_modified = meta.get("last_modified") if etag: headers["If-None-Match"] = etag if last_modified: headers["If-Modified-Since"] = last_modified try: resp = requests.get(MSF_METADATA_URL, headers=headers, timeout=DEFAULT_TIMEOUT) if resp.status_code == 304: # Not modified; use cache cached = _load_cached_json() if cached is None: # Unexpected: 304 but no cache; try full download resp = requests.get(MSF_METADATA_URL, timeout=DEFAULT_TIMEOUT) resp.raise_for_status() data = resp.json() _save_json_to_cache(data) # Update meta _write_meta( { "etag": resp.headers.get("ETag"), "last_modified": resp.headers.get("Last-Modified"), "fetched_at": int(time.time()), } ) return data, None return cached, None resp.raise_for_status() data = resp.json() _save_json_to_cache(data) _write_meta( { "etag": resp.headers.get("ETag"), "last_modified": resp.headers.get("Last-Modified"), "fetched_at": int(time.time()), } ) return data, None except requests.exceptions.RequestException as e: # Network failed; use cache if available cached = _load_cached_json() if cached is not None: return cached, None return None, f"❌ Error fetching Metasploit metadata: {e}" except ValueError as e: return None, f"❌ Error parsing Metasploit metadata JSON: {e}" def _rank_label(num: Any) -> str: try: n = int(num) except Exception: return "Unknown" return _RANK_LABELS.get(n, str(n)) def _build_index(metadata: Dict[str, Any]) -> Dict[str, List[Dict[str, Any]]]: """ Build a dict mapping CVE -> list[ModuleInfo] from modules_metadata_base.json Only consider CVE IDs present in the 'references' array of each module entry. """ index: Dict[str, List[Dict[str, Any]]] = {} for _key, mod in metadata.items(): if not isinstance(mod, dict): continue refs = mod.get("references") or [] if not isinstance(refs, list): continue # Extract CVE tokens from references only (high confidence) cves: List[str] = [] for ref in refs: if not isinstance(ref, str): continue for match in _CVE_REGEX.findall(ref): # Normalize format to uppercase canonical cves.append(match.upper()) if not cves: continue path = (mod.get("path") or "").lstrip("/") url = f"https://github.com/rapid7/metasploit-framework/blob/master/{path}" if path else None module_info = { "fullname": mod.get("fullname"), "type": mod.get("type"), "rank": mod.get("rank"), "rank_label": _rank_label(mod.get("rank")), "check": bool(mod.get("check", False)), "disclosure_date": mod.get("disclosure_date"), "url": url, "ref_name": mod.get("ref_name"), } for cve in set(cves): index.setdefault(cve, []).append(module_info) # Sort per-CVE by rank desc then name for cve, mods in index.items(): mods.sort(key=lambda m: (int(m.get("rank") or 0), str(m.get("fullname") or "")), reverse=True) return index def _ensure_index() -> Tuple[Optional[Dict[str, List[Dict[str, Any]]]], Optional[str]]: global _CVE_INDEX, _LAST_LOADED_ETAG if _CVE_INDEX is not None: return _CVE_INDEX, None data, err = _conditional_download() if err: return None, err if data is None: return None, "❌ Metasploit metadata is unavailable." _CVE_INDEX = _build_index(data) meta = _read_meta() _LAST_LOADED_ETAG = meta.get("etag") return _CVE_INDEX, None def fetch_metasploit_modules_for_cve(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Return Metasploit modules for a given CVE based solely on 'references' field matches. Output: { "modules": [ { "fullname": str, "type": "exploit" | "auxiliary" | "post" | None, "rank": int | None, "rank_label": str, "check": bool, "disclosure_date": str | None, "url": str | None, "ref_name": str | None }, ... ], "counts": { "exploit": int, "auxiliary": int, "post": int } } """ idx, err = _ensure_index() if err: return None, err cve_key = cve_id.upper() mods = list(idx.get(cve_key, [])) counts = {"exploit": 0, "auxiliary": 0, "post": 0} for m in mods: t = (m.get("type") or "").lower() if t in counts: counts[t] += 1 return {"modules": mods, "counts": counts}, None SploitScan-0.14.3/sploitscan/fetchers/nuclei.py000066400000000000000000000063531510166501000214730ustar00rootroot00000000000000""" Nuclei templates fetcher utilities. Strategy: 1) Try the cves.json NDJSON index (fast path). 2) If not found, try direct path on main: http/cves/{year}/{CVE}.yaml 3) If still not found, use GitHub code search API to locate the file path and construct a commit-pinned raw URL. Returns a dict similar to the NDJSON entry with at least: - ID - file_path Optionally includes: - raw_url (commit-pinned raw URL) """ from __future__ import annotations import json from typing import Any, Dict, Optional, Tuple import requests # type: ignore[import-untyped] from ..constants import NUCLEI_URL from .common import iter_json_lines RAW_BASE = "https://raw.githubusercontent.com/projectdiscovery/nuclei-templates" def _url_exists(url: str, timeout: int = 15) -> bool: try: resp = requests.get(url, timeout=timeout, stream=True) return resp.status_code < 400 except requests.RequestException: return False def _guess_main_path(cve_id: str) -> Optional[str]: try: year = cve_id.split("-")[1] except Exception: return None return f"http/cves/{year}/{cve_id}.yaml" def _search_github_path(cve_id: str) -> Tuple[Optional[str], Optional[str]]: """ Use GitHub code search to locate the nuclei template file path. Returns: (path, sha) or (None, None) """ try: url = "https://api.github.com/search/code" params = {"q": f"repo:projectdiscovery/nuclei-templates+filename:{cve_id}.yaml"} resp = requests.get(url, params=params, timeout=30) if resp.status_code != 200: return None, None data = resp.json() items = data.get("items", []) if not items: return None, None item = items[0] path = item.get("path") sha = item.get("sha") if path and sha: return path, sha return None, None except Exception: return None, None def fetch_nuclei_data(cve_id: str) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Find the Nuclei template metadata for a given CVE ID. Returns: (template_dict, None) if found (None, None) if not found (None, error_message) on error """ # 1) Try NDJSON index lines, err = iter_json_lines(NUCLEI_URL) if err: # Not fatal β€” continue with fallbacks lines = None if lines is not None: for line in lines: try: obj = json.loads(line) except json.JSONDecodeError: continue if obj.get("ID") == cve_id: return obj, None # 2) Try direct main path guess guess_path = _guess_main_path(cve_id) if guess_path: main_raw = f"{RAW_BASE}/main/{guess_path}" if _url_exists(main_raw): return {"ID": cve_id, "file_path": guess_path}, None # 3) GitHub code search to find a commit-pinned path path, sha = _search_github_path(cve_id) if path and sha: raw_url = f"{RAW_BASE}/{sha}/{path}" # Return file_path for compatibility with consumers, # and include raw_url for consumers that prefer commit-pinned links. return {"ID": cve_id, "file_path": path, "raw_url": raw_url}, None # Not found return None, None SploitScan-0.14.3/sploitscan/fetchers/vulncheck.py000066400000000000000000000021111510166501000221620ustar00rootroot00000000000000""" VulnCheck fetcher utilities. Requires an API key in config under "vulncheck_api_key". """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple from ..constants import VULNCHECK_API_URL from ..config import load_config from .common import fetch def fetch_vulncheck_data( cve_id: str, *, config: Optional[Dict[str, Any]] = None, ) -> Tuple[Optional[Dict[str, Any]], Optional[str]]: """ Fetch VulnCheck data for a CVE. Returns (json, None) on success, (None, error) on failure. """ cfg = config or load_config() api_key = cfg.get("vulncheck_api_key") if not api_key: return None, "No VulnCheck API key is configured." headers = { "accept": "application/json", "authorization": f"Bearer {api_key}", } resp, err = fetch(VULNCHECK_API_URL, params={"cve": cve_id}, headers=headers) if err: return None, err try: return resp.json(), None # type: ignore[return-value] except ValueError as e: return None, f"Error parsing JSON data from VulnCheck: {e}"SploitScan-0.14.3/sploitscan/importers/000077500000000000000000000000001510166501000200545ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/importers/__init__.py000066400000000000000000000107041510166501000221670ustar00rootroot00000000000000from __future__ import annotations import json import re import xml.etree.ElementTree as ET from typing import Callable, Iterable, List, Optional _CVE_REGEX = re.compile(r"CVE-\d{4}-\d{4,7}$") def is_valid_cve_id(cve_id: str) -> bool: return bool(_CVE_REGEX.match(cve_id)) def is_plaintext_cve_list(file_path: str) -> bool: try: with open(file_path, "r", encoding="utf-8") as f: for _ in range(10): line = f.readline() if not line: break val = line.strip().upper() if val and not is_valid_cve_id(val): return False return True except Exception: return False def parse_plaintext_cve_list(f) -> List[str]: return [line.strip().upper() for line in f if is_valid_cve_id(line.strip().upper())] def parse_nessus_file(f) -> List[str]: tree = ET.parse(f) root = tree.getroot() return [ (cve.text or "").strip().upper() for report_item in root.findall(".//ReportItem") for cve in report_item.findall("cve") if is_valid_cve_id((cve.text or "").strip().upper()) ] def parse_nexpose_file(f) -> List[str]: tree = ET.parse(f) root = tree.getroot() return [ (link.get("LinkTitle") or "").upper() for link in root.findall(".//URLLink") if (link.get("LinkTitle") or "").startswith("CVE-") ] def parse_openvas_file(f) -> List[str]: tree = ET.parse(f) root = tree.getroot() return [ (ref.attrib.get("id") or "").upper() for ref in root.findall(".//ref[@type='cve']") if is_valid_cve_id((ref.attrib.get("id") or "").upper()) ] def parse_docker_file(f) -> List[str]: data = json.load(f) return [ (rule.get("id") or "").upper() for run in data.get("runs", []) for rule in run.get("tool", {}).get("driver", {}).get("rules", []) if (rule.get("id") or "").startswith("CVE-") ] def import_file(file_path: str, parse_function: Callable) -> List[str]: try: with open(file_path, "r", encoding="utf-8") as f: cve_ids = parse_function(f) return list(set(cve_ids)) except ET.ParseError as e: print(f"❌ Error parsing the file '{file_path}': {e}") except json.JSONDecodeError as e: print(f"❌ Error parsing the JSON file '{file_path}': {e}") except Exception as e: print(f"❌ An unexpected error occurred while processing '{file_path}': {e}") return [] def import_vulnerability_data(file_path: str, file_type: Optional[str] = None) -> List[str]: if not file_path: return [] if not file_type: if is_plaintext_cve_list(file_path): return import_file(file_path, parse_plaintext_cve_list) else: print( f"❌ Error: The file '{file_path}' does not appear to be a valid list of CVEs. " "Please specify the correct file type using the --type option." ) return [] if file_type == "nessus": return import_file(file_path, parse_nessus_file) if file_type == "nexpose": return import_file(file_path, parse_nexpose_file) if file_type == "openvas": return import_file(file_path, parse_openvas_file) if file_type == "docker": return import_file(file_path, parse_docker_file) print(f"❌ Unsupported file type: {file_type}") return [] def import_vulnerability_data_from_dir(dir_path: str) -> List[str]: if not os.path.exists(dir_path): print(f"❌ Error: The directory '{dir_path}' does not exist.") return [] if not os.path.isdir(dir_path): print(f"❌ Error: '{dir_path}' is not a directory. Use --input-dir with a directory path.") return [] p = pathlib.Path(dir_path, encoding='utf-8').glob('**/*') reports_list = [str(x) for x in p if x.is_file()] cve_ids_list = [] for report_path in reports_list: cve_ids_list.extend(import_file(report_path, parse_cve_in_report)) unique_cve_ids = list(set(cve_ids_list)) print(f"πŸ“₯ Successfully imported {len(unique_cve_ids)} CVE(s) from '{dir_path}'\n") return unique_cve_ids def parse_cve_in_report(file): cve_pattern = r'CVE-\d{4}-\d{4,7}' try: content = file.read() return [cve.upper() for cve in re.findall(cve_pattern, content, re.IGNORECASE)] except Exception as e: print(f"❌ Error reading file '{file}': {e}") return [] SploitScan-0.14.3/sploitscan/metrics.py000066400000000000000000000105641510166501000200560ustar00rootroot00000000000000""" Security metrics helpers (CVSS extraction, priority calculation). """ from __future__ import annotations from typing import Any, Dict, Optional, Tuple from .constants import CVSS_THRESHOLD, EPSS_THRESHOLD def extract_cvss_info(cve_data: Optional[Dict[str, Any]]) -> Tuple[str, str, str]: """ Extract (base_score, base_severity, vector_string) from cvelistV5 JSON. Order of preference: - cvssV4_0 - cvssV3_1 - cvssV3_0 - cvssV3 - ADP entries (same order) Returns ("N/A", "N/A", "N/A") if not found. """ base_score, base_severity, vector = "N/A", "N/A", "N/A" if not cve_data or "containers" not in cve_data or "cna" not in cve_data["containers"]: return base_score, base_severity, vector cna = cve_data["containers"]["cna"] metrics = cna.get("metrics", []) for metric in metrics: cvss_data = ( metric.get("cvssV4_0") or metric.get("cvssV3_1") or metric.get("cvssV3_0") or metric.get("cvssV3") ) if cvss_data and cvss_data.get("baseScore"): base_score = cvss_data.get("baseScore", "N/A") base_severity = cvss_data.get("baseSeverity", "N/A") vector = cvss_data.get("vectorString", "N/A") return str(base_score), str(base_severity), str(vector) adp_entries = cve_data["containers"].get("adp", []) for adp_entry in adp_entries: for metric in adp_entry.get("metrics", []): cvss_data = ( metric.get("cvssV4_0") or metric.get("cvssV3_1") or metric.get("cvssV3_0") or metric.get("cvssV3") ) if cvss_data and cvss_data.get("baseScore"): base_score = cvss_data.get("baseScore", "N/A") base_severity = cvss_data.get("baseSeverity", "N/A") vector = cvss_data.get("vectorString", "N/A") return str(base_score), str(base_severity), str(vector) return str(base_score), str(base_severity), str(vector) def calculate_priority( cve_id: str, cve_data: Optional[Dict[str, Any]], epss_data: Optional[Dict[str, Any]], github_data: Optional[Dict[str, Any]], cisa_data: Optional[Dict[str, Any]], vulncheck_data: Optional[Dict[str, Any]], exploitdb_data: Optional[list], ) -> Optional[str]: """ Compute patching priority letter: - A+ if listed in CISA KEV or any public exploit observed - A if CVSS >= CVSS_THRESHOLD and EPSS >= EPSS_THRESHOLD - B if CVSS >= CVSS_THRESHOLD - C if EPSS >= EPSS_THRESHOLD - D otherwise when at least one signal exists - None if no signals are present """ cvss_score = 0.0 epss_score = 0.0 try: base_score, _, _ = extract_cvss_info(cve_data) cvss_score = float(base_score) except (TypeError, ValueError): pass try: epss_score = float(epss_data["data"][0]["epss"]) if epss_data and "data" in epss_data else 0.0 except (KeyError, IndexError, TypeError, ValueError): pass in_cisa_kev = False if cisa_data and isinstance(cisa_data, dict): vulns = cisa_data.get("vulnerabilities", []) in_cisa_kev = any(isinstance(v, dict) and v.get("cveID") == cve_id for v in vulns) has_public_exploits = False if github_data and isinstance(github_data, dict): has_public_exploits = bool(github_data.get("pocs")) if not has_public_exploits and vulncheck_data and isinstance(vulncheck_data, dict): has_public_exploits = bool(vulncheck_data.get("data")) if not has_public_exploits and exploitdb_data: has_public_exploits = bool(exploitdb_data) if not (cvss_score or epss_score or in_cisa_kev or has_public_exploits): return None if in_cisa_kev: base_grade = "A+" elif cvss_score >= CVSS_THRESHOLD and epss_score >= EPSS_THRESHOLD: base_grade = "A" elif cvss_score >= CVSS_THRESHOLD: base_grade = "B" elif epss_score >= EPSS_THRESHOLD: base_grade = "C" else: base_grade = "D" # Grade escalation if public exploit is known if has_public_exploits and base_grade != "A+": grade_order = ["D", "C", "B", "A", "A+"] current_index = grade_order.index(base_grade) new_index = min(current_index + 2, len(grade_order) - 1) return grade_order[new_index] return base_grade SploitScan-0.14.3/sploitscan/paths.py000066400000000000000000000015421510166501000175230ustar00rootroot00000000000000""" Path utilities for SploitScan. - Computes locations for local CVE repository and subdirectories - Honors configured local_database_dir when provided """ from __future__ import annotations import os from typing import Dict, Optional def get_cve_repo_dir(config: Optional[Dict] = None) -> str: """ Return the base directory for the local cvelistV5 repository. If config provides "local_database_dir", use it; otherwise default to ~/.sploitscan """ base_dir = None if config: base_dir = config.get("local_database_dir") if not base_dir: base_dir = os.path.expanduser("~/.sploitscan") return os.path.join(base_dir, "cvelistV5") def get_cve_local_dir(config: Optional[Dict] = None) -> str: """Return the path to the local cvelistV5/cves directory.""" return os.path.join(get_cve_repo_dir(config), "cves") SploitScan-0.14.3/sploitscan/repo.py000066400000000000000000000075021510166501000173530ustar00rootroot00000000000000""" Local CVE repository management (clone/pull) and keyword search utilities. """ from __future__ import annotations import concurrent.futures import json import os from typing import Iterable, List, Optional from git import Repo, GitCommandError, RemoteProgress from tqdm import tqdm from .paths import get_cve_repo_dir, get_cve_local_dir class CloneProgress(RemoteProgress): def update(self, op_code, cur_count, max_count=None, message=""): if max_count: try: percent = (cur_count / max_count) * 100 except Exception: percent = 0.0 print(f"πŸ”„ Progress: {percent:.2f}% - {message}", end="\r") else: print(f"πŸ”„ {message}", end="\r") def clone_cvelistV5_repo(*, config: Optional[dict] = None) -> Optional[str]: """ Clone or update the CVEProject/cvelistV5 repository into the configured local directory. Returns the local directory path on success, or None on failure. """ local_dir = get_cve_repo_dir(config) repo_url = "https://github.com/CVEProject/cvelistV5.git" os.makedirs(local_dir, exist_ok=True) git_dir = os.path.join(local_dir, ".git") if not os.path.exists(git_dir): try: print(f"πŸ“₯ Cloning CVE List V5 into '{local_dir}'.") print("⚠️ Warning: The repository is several GB in size and the download may take a while.") Repo.clone_from(repo_url, local_dir, progress=CloneProgress()) print("\nβœ… CVE List V5 cloned successfully.") except GitCommandError as e: print(f"❌ Error cloning cvelistV5: {e}") return None else: try: repo = Repo(local_dir) if repo.bare: print(f"❌ Repository at '{local_dir}' is bare. Cannot pull updates.") return None print(f"πŸ“₯ Pulling updates in '{local_dir}'...") repo.remotes.origin.pull() print("βœ… Repository updated successfully.") except GitCommandError as e: print(f"❌ Error pulling updates: {e}") return None return local_dir def _file_contains_all_keywords(file_path: str, keywords_lower: List[str]) -> Optional[str]: try: with open(file_path, "r", encoding="utf-8") as f: content = f.read().lower() if all(kw in content for kw in keywords_lower): return os.path.splitext(os.path.basename(file_path))[0] except Exception as e: print(f"Error reading file {file_path}: {e}") return None def grep_local_db(keywords: Iterable[str], *, config: Optional[dict] = None) -> Optional[List[str]]: """ Search the local cvelistV5 JSON files for occurrences of all provided keywords. Returns a list of CVE IDs (filenames) when matches are found, otherwise None. """ local_dir = get_cve_local_dir(config) if not os.path.exists(local_dir): print("Local CVE database not found.") return None keywords_lower = [kw.lower() for kw in (list(keywords) if not isinstance(keywords, str) else [keywords])] print(f"β”Œβ”€β”€β”€[ πŸ•΅οΈ Searching local database for keywords: {', '.join(keywords_lower)} ]") json_files: List[str] = [] for root, _, files in os.walk(local_dir): for filename in files: if filename.endswith(".json"): json_files.append(os.path.join(root, filename)) matching_files: List[str] = [] with concurrent.futures.ThreadPoolExecutor() as executor: for result in tqdm( executor.map(lambda p: _file_contains_all_keywords(p, keywords_lower), json_files), total=len(json_files), desc="Processing CVE files", ): if result is not None: matching_files.append(result) return matching_files if matching_files else None SploitScan-0.14.3/sploitscan/search.py000066400000000000000000000034611510166501000176530ustar00rootroot00000000000000from __future__ import annotations import json from typing import Iterable, List, Optional, Set from .repo import grep_local_db from .fetchers.cisa import fetch_cisa_data from .fetchers.common import iter_json_lines from .constants import NUCLEI_URL def search_cve_by_keywords(keywords: Iterable[str]) -> List[str]: """ Aggregate CVE IDs matching all keywords across: - Local cvelistV5 JSON database (if present) - CISA KEV JSON - Nuclei cves.json NDJSON index Matching is case-insensitive and requires all keywords to be present within the serialized record. """ kws = [k.lower() for k in (list(keywords) if not isinstance(keywords, str) else [keywords])] results: Set[str] = set() # Local grep local_cve_ids = grep_local_db(kws) if local_cve_ids: results.update(local_cve_ids) # CISA feed cisa_data, cisa_err = fetch_cisa_data() if cisa_data and not cisa_err: for item in cisa_data.get("vulnerabilities", []): try: item_str = json.dumps(item).lower() except Exception: continue if all(kw in item_str for kw in kws): cve_id = item.get("cveID") if cve_id: results.add(cve_id) # Nuclei NDJSON lines, nuclei_err = iter_json_lines(NUCLEI_URL) if lines and not nuclei_err: for line in lines: try: lower = line.lower() except Exception: continue if all(kw in lower for kw in kws): try: obj = json.loads(line) cve_id = obj.get("ID") if cve_id: results.add(cve_id) except Exception: continue return sorted(results) SploitScan-0.14.3/sploitscan/sploitscan.py000066400000000000000000000011111510166501000205530ustar00rootroot00000000000000#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations try: from .cli import cli except Exception: # If run as a script from inside the "sploitscan" directory, add the project root to sys.path import os import sys pkg_dir = os.path.dirname(os.path.abspath(__file__)) # .../SploitScan/sploitscan project_root = os.path.dirname(pkg_dir) # .../SploitScan if project_root not in sys.path: sys.path.insert(0, project_root) from sploitscan.cli import cli if __name__ == "__main__": cli() SploitScan-0.14.3/sploitscan/templates/000077500000000000000000000000001510166501000200265ustar00rootroot00000000000000SploitScan-0.14.3/sploitscan/templates/report_template.html000066400000000000000000001106241510166501000241260ustar00rootroot00000000000000 SploitScan Report

SploitScan

Modern CVE & Exploit Aggregation Report

{{ "v" }}{{ 0 }}{{ "." }}{{ 14 }}{{ "." }}{{ 2 }}
{% set total = cve_data|length %} {% set ns = namespace(aplus=0, cisa=0, exploits=0, cvss_sum=0.0, cvss_n=0) %} {% for r in cve_data %} {# Priority A+ count #} {% set pr = (r.get('Priority') and r['Priority'].get('Priority')) %} {% if pr == 'A+' %}{% set ns.aplus = ns.aplus + 1 %}{% endif %} {# CISA-listed count (kept for possible future card) #} {% if r.get('CISA Data') and (r['CISA Data'].get('cisa_status') == 'Yes') %}{% set ns.cisa = ns.cisa + 1 %}{% endif %} {# Has public exploits (robust fallback mirrors the table computation) #} {% set expl = r.get('Public Exploits Total') %} {% if expl is none or expl == 0 %} {% set expl = ( (r.get('GitHub Data') and r['GitHub Data'].get('pocs')|length or 0) + (r.get('VulnCheck Data') and (r['VulnCheck Data'].get('data')|sum(attribute='vulncheck_xdb')|length if r['VulnCheck Data'].get('data') else 0) or 0) + (r.get('ExploitDB Data') and r['ExploitDB Data']|length or 0) + (r.get('Metasploit Data') and r['Metasploit Data'].get('modules')|length or 0) + ((r.get('Nuclei Data') and (r['Nuclei Data'].get('file_path') or r['Nuclei Data'].get('raw_url'))) and 1 or 0) ) %} {% endif %} {% if expl > 0 %}{% set ns.exploits = ns.exploits + 1 %}{% endif %} {# Average CVSS #} {% if r.get('CVE Data') and r['CVE Data'].get('cvss_info') %} {% set score = r['CVE Data']['cvss_info'].get('baseScore', 0) %} {% set ns.cvss_sum = ns.cvss_sum + (score|float) %} {% set ns.cvss_n = ns.cvss_n + 1 %} {% endif %} {% endfor %} {% set avg_cvss = ns.cvss_n and (ns.cvss_sum / ns.cvss_n) or 0 %}
Total CVEs
{{ total }}
Priority A+
{{ ns.aplus }}
Has Public Exploits
{{ ns.exploits }}
Avg. CVSS
{{ '%.1f'|format(avg_cvss) }}

Summary

Click headers to sort
{% for r in cve_data %} {% set meta = r['CVE Data'] and r['CVE Data'].get('cveMetadata', {}) or {} %} {% set cve_id = meta.get('cveId', 'N/A') %} {% set pub = meta.get('datePublished', '') %} {% set cvss = (r['CVE Data'] and r['CVE Data'].get('cvss_info') and r['CVE Data']['cvss_info'].get('baseScore')) or 0 %} {% set epss = (r['EPSS Data'] and r['EPSS Data'].get('data') and r['EPSS Data']['data'] and r['EPSS Data']['data'][0].get('epss', 0)) or 0 %} {% set pr = r['Priority'] and r['Priority'].get('Priority') or '' %} {% set pr_class = 'priority-' ~ pr %} {% set cisa = (r['CISA Data'] and r['CISA Data'].get('cisa_status') == 'Yes') %} {% set expl = r['Public Exploits Total'] or ( (r.get('GitHub Data') and r['GitHub Data'].get('pocs')|length or 0) + (r.get('VulnCheck Data') and (r['VulnCheck Data'].get('data')|sum(attribute='vulncheck_xdb')|length if r['VulnCheck Data'].get('data') else 0) or 0) + (r.get('ExploitDB Data') and r['ExploitDB Data']|length or 0) + (r.get('Metasploit Data') and r['Metasploit Data'].get('modules')|length or 0) + ((r.get('Nuclei Data') and (r['Nuclei Data'].get('file_path') or r['Nuclei Data'].get('raw_url'))) and 1 or 0) ) %} {% endfor %}
CVE CVSS EPSS% Priority CISA Expl. Published
{{ cve_id }} {{ cvss and ('%.1f'|format(cvss)) or 'N/A' }} {{ epss and ('%.1f'|format(epss * 100)) or '0.0' }} {{ pr or 'N/A' }} {% if cisa %} Yes {% else %} No {% endif %} {{ expl }} {{ pub and (pub[:10]) or 'N/A' }}
{% for cve in cve_data %} {% set cve_meta = cve['CVE Data'].get('cveMetadata', {}) if cve['CVE Data'] else {} %} {% set containers = cve['CVE Data'].get('containers', {}) if cve['CVE Data'] else {} %} {% set cna = containers.get('cna', {}) %} {% set references = cna.get('references', []) %} {% set descriptions = cna.get('descriptions', []) %} {% set description = descriptions and descriptions[0].get('value') or 'N/A' %} {% set cve_id = cve_meta.get('cveId', 'N/A') %} {% set date_published = cve_meta.get('datePublished', None) %} {% set cvss_info = cve['CVE Data'].get('cvss_info') if cve['CVE Data'] else None %} {% set base_score = (cvss_info and cvss_info.get('baseScore')) or 'N/A' %} {% set base_severity = (cvss_info and cvss_info.get('baseSeverity')) or 'N/A' %} {% set vector_string = (cvss_info and cvss_info.get('vectorString')) or 'N/A' %} {% set epss_val = (cve['EPSS Data'] and cve['EPSS Data'].get('data') and cve['EPSS Data']['data'] and cve['EPSS Data']['data'][0].get('epss', 0)) or 0 %} {% set pr = cve['Priority'] and cve['Priority'].get('Priority') or '' %} {% set pr_class = pr and ('priority-' ~ pr) or '' %} {% set cisa_listed = (cve['CISA Data'] and cve['CISA Data'].get('cisa_status') == 'Yes') %} {% set github_count = (cve['GitHub Data'] and cve['GitHub Data'].get('pocs')|length) or 0 %} {% set vulncheck_count = 0 %} {% if cve['VulnCheck Data'] and cve['VulnCheck Data'].get('data') %} {% for item in cve['VulnCheck Data']['data'] %} {% set vulncheck_count = vulncheck_count + (item.get('vulncheck_xdb')|length) %} {% endfor %} {% endif %} {% set edb_count = cve['ExploitDB Data'] and cve['ExploitDB Data']|length or 0 %} {% set msf_count = (cve['Metasploit Data'] and cve['Metasploit Data'].get('modules')|length) or 0 %} {% set nuclei_link = None %} {% if cve['Nuclei Data'] %} {% if cve['Nuclei Data'].get('raw_url') %} {% set nuclei_link = cve['Nuclei Data']['raw_url'] %} {% elif cve['Nuclei Data'].get('file_path') %} {% set nuclei_link = 'https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/' ~ cve['Nuclei Data']['file_path'] %} {% endif %} {% endif %}

{{ cve_id }}

{% if pr %} {{ pr }} {% endif %} {% if cisa_listed %} CISA KEV {% endif %} {% if (github_count + vulncheck_count + edb_count + msf_count + (nuclei_link and 1 or 0)) > 0 %} Has Exploits {% endif %} {% if cve['Risk Assessment'] %} AI {% endif %}
Back to top
Published
{{ date_published and (date_published[:10]) or 'N/A' }}
CVSS: {{ base_score }} ({{ base_severity }}) Vector: {{ vector_string }} EPSS: {{ epss_val and ('%.2f'|format(epss_val * 100)) or '0.00' }}%
Description

{{ description }}

Patching Priority
{% if pr %} {{ pr }} {% else %} N/A {% endif %}

{% if pr == 'A+' %} Elevated risk due to CISA listing or public exploits present. {% elif pr == 'A' %} High severity CVSS plus elevated EPSS likelihood. {% elif pr == 'B' %} High severity CVSS with lower EPSS probability. {% elif pr == 'C' %} Lower CVSS severity but elevated EPSS likelihood. {% elif pr == 'D' %} Lower severity and lower EPSS probability. {% else %} Insufficient signals for a calculated priority. {% endif %}

Public Exploits
{% if github_count > 0 %}
GitHub
{% endif %} {% if vulncheck_count > 0 %}
VulnCheck
    {% for item in cve['VulnCheck Data']['data'] %} {% for xdb in item['vulncheck_xdb'] %} {% set url = xdb['clone_ssh_url'].replace('git@github.com:', 'https://github.com/').replace('.git','') %}
  • {{ url }}
  • {% endfor %} {% endfor %}
{% endif %} {% if edb_count > 0 %}
Exploit‑DB
{% endif %} {% if msf_count > 0 %}
Metasploit
    {% for m in cve['Metasploit Data']['modules'] %} {% set label = m.get('fullname') ~ (m.get('rank_label') and (' [' ~ m.get('rank_label') ~ ']') or '') %} {% if m.get('url') %}
  • {{ label }}
  • {% else %}
  • {{ label }}
  • {% endif %} {% endfor %}
{% endif %} {% if nuclei_link %} {% endif %} {% if (github_count + vulncheck_count + edb_count + (nuclei_link and 1 or 0)) == 0 %}
No public exploits found.
{% endif %}
CISA KEV Catalog
{% if cisa_listed %} Listed {% else %} Not Listed {% endif %} Ransomware: {{ cve['CISA Data'] and cve['CISA Data'].get('ransomware_use','Unknown') or 'Unknown' }}
HackerOne
{% if cve['HackerOne Data'] and cve['HackerOne Data'].get('data') and cve['HackerOne Data']['data'].get('cve_entry') %} {% set h1 = cve['HackerOne Data']['data']['cve_entry'] %}
Rank: {{ h1.get('rank','N/A') }} Reports: {{ h1.get('reports_submitted_count','N/A') }} Critical: {{ h1.get('severity_count_critical',0) }} High: {{ h1.get('severity_count_high',0) }} Medium: {{ h1.get('severity_count_medium',0) }} Low: {{ h1.get('severity_count_low',0) }} Unknown: {{ h1.get('severity_count_unknown',0) }}
{% else %}
No HackerOne data available.
{% endif %}
{% if cve['Risk Assessment'] %}
πŸ€– AI-Powered Risk Assessment
{{ cve['Risk Assessment'] }}
{% endif %}
References
{% if references %} {% else %}
No further references.
{% endif %}
{% endfor %}
Generated by SploitScan β€’ {{ (cve_data|length) }} CVE(s)
SploitScan-0.14.3/sploitscan/utils.py000066400000000000000000000027361510166501000175520ustar00rootroot00000000000000""" Utility helpers for SploitScan. """ from __future__ import annotations import datetime import os import re from typing import Iterable, List def parse_iso_date(date_string: str, date_format: str = "%Y-%m-%d") -> str: """ Parse an ISO date string (optionally ending with 'Z') and format it. Returns the original string if parsing fails or input is falsy. """ if not date_string: return "" try: return datetime.datetime.fromisoformat(date_string.rstrip("Z")).strftime(date_format) except ValueError: return date_string def datetimeformat(value: str, format: str = "%Y-%m-%d") -> str: """Jinja2 filter wrapper to format ISO dates.""" return parse_iso_date(value, format) _CVE_REGEX = re.compile(r"CVE-\d{4}-\d{4,7}$") def is_valid_cve_id(cve_id: str) -> bool: """Validate CVE ID format (CVE-YYYY-NNNN+).""" return bool(_CVE_REGEX.match(cve_id)) def generate_filename(cve_ids: Iterable[str], extension: str) -> str: """ Generate a timestamped filename like: 20250101T123456Z_CVE-2024-1709_CVE-2024-21413_and_more_export.html """ ts = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%SZ") ids: List[str] = list(cve_ids) cve_part = "_".join(ids[:3]) + ("_and_more" if len(ids) > 3 else "") cve_part = cve_part or "report" base_dir = "/results" if os.path.exists('/results') else "." filename = os.path.join(base_dir, f"{ts}_{cve_part}_export.{extension.lower()}") return filename