Skip to main content

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

Metadata

Release files for vuln-structure 2025.12.22090418

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vuln-structure 2025.12.22090418
File Size Uploaded
vuln_structure-2025.12.22090418.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vuln-structure 2025.12.22090418
File Interpreter ABI Platform
vuln_structure-2025.12.22090418-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / vuln_structure-2025.12.22090418.tar.gz

Download URL vuln_structure-2025.12.22090418.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8a2307d8d8612159afe118f517406f8860c69aa12d39aa3ac52d72d74d213e6d
BLAKE2b-256 checksum
How to use checksums
fa5a113bf534cc8dc3d75ec0b9b4e0326bf4d8abbca934302132184714f7f504
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / vuln_structure-2025.12.22090418-py3-none-any.whl

Download URL vuln_structure-2025.12.22090418-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b42cebc6355863e88c028e0926894f1f28468188e6b985f863489aa386655111
BLAKE2b-256 checksum
How to use checksums
628c7de41c90e86d3c79399fbff6315ae9083fc5ae1dcceab12ed002a7fea0b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.22090418 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page