# NPM Log Analysis Tools High-performance security analysis tools for NPM (Nginx Proxy Manager) logs. ## Overview This repository contains two versions of the NPM log analyzer: 1. **Bash Version** (`npm-log-analyzer.sh`) - Interactive menu-driven tool 2. **Go Version** (`npm-log-analyzer.go`) - High-performance command-line tool ## Features ### Security Pattern Detection - **Critical Attacks**: SQL injection, XSS, shell/RCE, webshell uploads - **High Priority**: Path traversal, WordPress hunting, backup harvesting - **Reconnaissance**: Robots.txt requests, vulnerability scanners, error spam - **Advanced**: SSRF, LFI/RFI, deserialization, template injection ### Analysis Capabilities - Real-time log processing - IP address analysis and geolocation - Attack pattern counting and categorization - Comprehensive reporting - Performance optimization for large log files ## Quick Start ### Go Version (Recommended) ```bash # Build and run make go # Or manually go build -o npm-log-analyzer-go npm-log-analyzer.go ./npm-log-analyzer-go ``` ### Bash Version ```bash # Make executable and run chmod +x npm-log-analyzer.sh ./npm-log-analyzer.sh ``` ## Performance Comparison | Feature | Go Version | Bash Version | |---------|------------|--------------| | **Speed** | ~85 seconds for 260MB logs | ~2-3 minutes | | **Memory** | Efficient streaming | Higher memory usage | | **Features** | Command-line focused | Interactive menu | | **Dependencies** | Single binary | Requires bash, grep, etc. | | **Gzip Support** | ✅ Native | ❌ Limited | ## Recent Analysis Results From the latest Go analysis (260MB of logs): ### Critical Findings - **SQL Injection Attempts**: 378 - **Shell/RCE Attempts**: 2,693 - **Error Spam (404/403)**: 4,855 ### Top Attack Sources - **169.150.203.13**: 45,278 requests (suspicious high volume) - **135.181.143.221**: 9,229 requests - **97.120.203.58**: 3,405 requests ### Analysis Statistics - **Processed Files**: 98 - **Total Lines**: 105,568 - **Unique IPs**: 959 - **Duration**: ~85 seconds ## Configuration ### Log Directory Both tools expect NPM logs at: `/opt/stacks/npm/data/logs` ### Output Directory Reports are saved to: `./npmlogs` ### Attack Patterns Patterns are defined in the source code and can be customized: ```go // Go version var AttackPatterns = map[string]string{ "sql_injection": `union|select|insert|drop|delete`, "xss": `