How prnig/pullei works
Project Type and Purpose
• Type: Command-line interface (CLI) utility written in Python
• Purpose:
– Connect to the GitHub API to fetch pull requests from projectdiscovery/nuclei-templates
– Filter out templates already present locally
– Download new templates into a “pullei” folder under ~/nuclei-templates (or a custom path)
File Structure
• Top-level files only:
– pullei.py (main script containing CLI parser, GitHub client, file-IO logic)
– README.md (usage & feature overview)
– LICENSE
• No subdirectories or microservices—this is a single-process, script-based tool
README for Architectural Clues
• The tool uses:
– argparse (for CLI flags: –cves-only, –github-token, etc.)
– GitHub REST API (60 unauthenticated calls/hour, token support for higher rate)
– Filesystem operations (creating directories, writing .yaml template files)
Main Components
a. CLI Parser Module (argparse)
b. GitHub API Client (requests or built-in HTTP library)
c. Template Filter Logic (identifies which PR files are new)
d. Local Filesystem Interface (folder creation, file writes)
e. Optional Authentication Layer (GitHub token)
Relationships and Data Flow
• User invokes python3 pullei.py [flags] → CLI Parser
• CLI Parser configures:
– GitHub token (if provided)
– Path to nuclei-templates
– Download directory
• GitHub API Client authenticates (optional) → queries PRs endpoint
• Template Filter examines each PR’s file list → compares to local folder contents
• Filtered templates are downloaded → Local Filesystem writes files into “pullei” folder
• Errors and progress messages returned back to CLI for user feedback
Architectural Patterns & Principles
• Single responsibility: separate parsing, API access, filtering, and file I/O into distinct functions or modules
• Layered design:
– Presentation layer (CLI)
– Service layer (GitHub HTTP client)
– Business logic (filtering new templates)
– Persistence (filesystem)
• Optional configuration injection via CLI flags
Technologies and Libraries
• Python 3.x standard library: argparse, os, pathlib, logging
• HTTP library (requests or urllib) for GitHub REST calls
• GitHub REST API v3 (PRs endpoint)