Skip to main content

vuln-structure is a package that extracts vulnerability details from raw text and outputs standardized, structured data for security teams.

Project description

Vuln‑Structure

PyPI version License: MIT Downloads LinkedIn

A lightweight Python package that extracts and structures critical security vulnerability information from unstructured text.
Given a raw description of a cybersecurity flaw (for example, the WatchGuard firewall RCE vulnerability), vuln_structure returns a list of clean, machine‑readable data entries that include:

  • Vulnerability type
  • Affected systems
  • Potential impact
  • Recommended actions

It uses the llmatch-messages library to validate that the data returned by the LLM matches a strict regular‑expression pattern, ensuring consistent formatting for automated processing.

Tip: The output is intentionally simple CSV‑like items so that security teams can drop the data into dashboards, SIEMs, or other triage tools with minimal plumbing.


📦 Installation

pip install vuln_structure

⚡ Quick Start

from vuln_structure import vuln_structure

user_input = """
WatchGuard WatchGuard Firebox RCE vulnerability. A remote attacker can trigger
remote code execution by sending a specially crafted GET request on port 80.
"""

# Using the default LLM7 model
results = vuln_structure(user_input)

# results is a list of strings, one per extracted data item.
print(results)

📚 Alternative LLM Backends

The function accepts any langchain_core.language_models.BaseChatModel instance.
Below are short examples for the most common back‑ends.

OpenAI

from langchain_openai import ChatOpenAI
from vuln_structure import vuln_structure

llm = ChatOpenAI()  # API key taken from environment (`OPENAI_API_KEY`)

results = vuln_structure(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from vuln_structure import vuln_structure

llm = ChatAnthropic()  # API key taken from environment (`ANTHROPIC_API_KEY`)

results = vuln_structure(user_input, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from vuln_structure import vuln_structure

llm = ChatGoogleGenerativeAI()  # API key from `GOOGLE_API_KEY`

results = vuln_structure(user_input, llm=llm)

Note: If you don't pass an llm argument, the package will automatically initialise a ChatLLM7 instance (from the langchain_llm7 package). The free tier of LLM7 imposes generous rate limits that are usually sufficient for typical use cases.


🚀 Configuration

Parameter Type Description
user_input str Raw vulnerability description.
llm Optional[BaseChatModel] LangChain LLM instance. If omitted, a default ChatLLM7 is used.
api_key Optional[str] API key for LLM7. If omitted, the code will look for the LLM7_API_KEY environment variable; a fallback value of "None" is used if both are missing.

🔑 Getting an LLM7 API Key

  1. Sign up at the LLM7 token portal.
  2. Store the key safely:
    export LLM7_API_KEY="your_token_here"
    
    or pass it directly: vuln_structure(user_input, api_key="your_token_here").

🗂️ Output Format

Each item in the returned list is a single line that follows the regex pattern defined in prompts.py.
Typical items look like:

"Vulnerability: Remote Code Execution (CVE‑2023‑5265)"
"Affected System: WatchGuard Firebox Series, Version ≤ 4.6.0"
"Impact: Full system compromise"
"Mitigation: Update to version 4.6.1 or later"

You can easily parse these strings into JSON or CSV with standard Python tools.


🤝 Contributing & Issues


📄 License

This project is licensed under the MIT License.


📬 Author

Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vuln_structure-2025.12.22090418.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vuln_structure-2025.12.22090418-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file vuln_structure-2025.12.22090418.tar.gz.

File metadata

File hashes

Hashes for vuln_structure-2025.12.22090418.tar.gz
Algorithm Hash digest
SHA256 8a2307d8d8612159afe118f517406f8860c69aa12d39aa3ac52d72d74d213e6d
MD5 dc8799629cb9e239e25d3aac595206d0
BLAKE2b-256 fa5a113bf534cc8dc3d75ec0b9b4e0326bf4d8abbca934302132184714f7f504

See more details on using hashes here.

File details

Details for the file vuln_structure-2025.12.22090418-py3-none-any.whl.

File metadata

File hashes

Hashes for vuln_structure-2025.12.22090418-py3-none-any.whl
Algorithm Hash digest
SHA256 b42cebc6355863e88c028e0926894f1f28468188e6b985f863489aa386655111
MD5 40f7ac34fda529f6e3824c262d50d8fc
BLAKE2b-256 628c7de41c90e86d3c79399fbff6315ae9083fc5ae1dcceab12ed002a7fea0b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page