Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 2.54 KB

File metadata and controls

96 lines (69 loc) · 2.54 KB

VulnerabilityViewer

A collection of Jupyter notebooks for viewing and parsing JSON and JSONL files, with a focus on extracting and analyzing code snippets and vulnerability data.

Features

  • JSON Viewer: Parse and view JSON files with code extraction capabilities
  • JSONL Viewer: Parse and view JSON Lines files with batch processing
  • Code Extraction: Automatically detect and extract code snippets from JSON data
  • Statistics: Get detailed statistics about JSON/JSONL structure
  • Search & Filter: Search for specific keys and filter records

Notebooks

1. json_viewer.ipynb

A comprehensive notebook for viewing and parsing JSON files.

Features:

  • Load and parse JSON files
  • Display formatted JSON data
  • Extract code snippets from JSON
  • Get JSON structure statistics
  • Search for specific keys
  • Handle nested structures

2. jsonl_viewer.ipynb

A notebook designed for JSON Lines (JSONL) format files.

Features:

  • Load and parse JSONL files (one JSON object per line)
  • Display individual records
  • Extract code from multiple records
  • Get statistics across all records
  • Filter records by key or value
  • Convert JSONL to JSON format

Getting Started

Prerequisites

pip install jupyter notebook

Usage

  1. Start Jupyter Notebook:
jupyter notebook
  1. Open either json_viewer.ipynb or jsonl_viewer.ipynb

  2. Update the file path in the example usage cells:

# For JSON files
json_file_path = 'your_file.json'

# For JSONL files
jsonl_file_path = 'your_file.jsonl'
  1. Run the cells to view and analyze your data

Sample Data

The repository includes sample files for testing:

  • sample_vulnerability.json: Example JSON file with vulnerability data and code snippets
  • sample_vulnerabilities.jsonl: Example JSONL file with multiple vulnerability records

Code Extraction

Both notebooks can automatically extract code snippets from JSON data by searching for common code-related keys:

  • code
  • snippet
  • source
  • body
  • content
  • text
  • script
  • program

The extracted code is displayed with its location path in the JSON structure.

Use Cases

  • Security Analysis: View vulnerability reports with code snippets
  • Data Exploration: Explore JSON/JSONL datasets interactively
  • Code Review: Extract and review code snippets from JSON data
  • Data Processing: Parse and filter large JSONL files
  • Format Conversion: Convert between JSON and JSONL formats

License

This project is licensed under the MIT License - see the LICENSE file for details.