Skip to content

Cybersecurity-Enthusiasts-from-42/KernelGuard-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KernelGuard-AI

KernelGuard-AI is an AI-assisted static analysis framework focused on Linux kernel–style C code.

This repository is a starter kit for building tools that:

  • Scan kernel C files for memory safety, concurrency, and style issues.
  • Provide JSON / human-readable reports.
  • Integrate future LLM-based explanations and remediation suggestions.

⚠️ This is a scaffolding project: most components are implemented as clean, extendable stubs so you can add real static analysis and LLM logic.

Features (Starter Version)

  • CLI to analyze single files or folders.
  • Rule-based analysis engine (memory, concurrency, style categories).
  • Pluggable rule system (kernelguard_ai.rules.*).
  • Simple C token/structure parser placeholder (parser.py) ready to be replaced with Clang / tree-sitter.
  • JSON report output + pretty console summaries.
  • LLM integration hook (kernelguard_ai.llm.explain) where you can connect OpenAI, local models, etc.
  • Basic tests with pytest.

Quick Start

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # on Windows: .venv\Scripts\activate

# Install in editable mode (once you add dependencies)
pip install -e .

# Run analysis on example file
kernelguard-ai analyze examples/sample_kernel.c --format table

# Or as a module
python -m kernelguard_ai.cli analyze examples/sample_kernel.c --format json

Project Layout

KernelGuard-AI/
  kernelguard_ai/
    analyzer/
    rules/
    llm/
    cli.py
    config.py
  examples/
  tests/

Roadmap Ideas

  • Replace parser.py with a real C AST parser (Clang, pycparser, or tree-sitter).
  • Implement real kernel-specific rules (locking, RCU, reference counting).
  • Add SARIF output for IDE and CI integration.
  • Connect kernelguard_ai.llm to an LLM API for natural-language explanations and patch suggestions.
  • Build a simple web UI (FastAPI + React / Next.js) on top of the core engine.

License

Choose your own (MIT / Apache-2.0 recommended). This starter kit ships without a license so you can decide.

About

AI-powered static analyzer for Linux kernel–style C code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages