Skip to content

Latest commit

 

History

History
303 lines (244 loc) · 7.03 KB

File metadata and controls

303 lines (244 loc) · 7.03 KB

🚀 NetMon-AI Enhancement Summary

✨ New Features Added (February 2026)

1. Enhanced Shell Experience

  • Piping & Redirection: Support for | (pipes) and > (output redirection)

    ask "list processes" | search python
    pslist > processes.txt
  • Git Branch Detection: Automatically shows current Git branch in prompt

    /home/user/project (main) $
    
  • Persistent Command History:

    • History saved across sessions
    • Ctrl+R for reverse search (Unix-like systems)
    • history command to view past commands
  • Enhanced Tab Completion:

    • Command suggestions
    • File path completion
    • Alias suggestions

2. Advanced File Operations

# Search for text in files (grep-like)
search "error" /var/log/syslog

# Display file contents
cat config.yaml

# Create/update file timestamp
touch newfile.txt

# Enhanced ls with color coding
ls /etc

3. Command Aliases System

Create shortcuts for frequently used commands:

# Create alias
alias ll "ls -la"
alias health-check "health"

# Use alias
ll

# View all aliases
aliases

# Remove alias
unalias ll

4. System Health Scoring

# Get overall system health score (0-100)
health

# Output:
# === System Health Report ===
# CPU Usage: 45.2% (Score: 54.8/100)
# Memory Usage: 62.1% (Score: 37.9/100)
# Disk Usage: 78.5% (Score: 21.5/100)
# 
# Overall Health: 38.1/100 - FAIR

5. Intelligent Alerting System 🔔

# View recent alerts
alerts 20

# View configuration
alert-config

# Set custom thresholds
set-threshold cpu 75 90
set-threshold memory 80 95

# Configuration includes:
# - Configurable thresholds per resource
# - Multiple notification channels (console, file, email, webhook)
# - Alert suppression/deduplication
# - Alert history tracking

Alert Features:

  • 🔴 CRITICAL alerts for resources >90%
  • 🟡 WARNING alerts for resources >75%
  • 🔵 INFO alerts for general events
  • Automatic deduplication (5-minute window)
  • Multiple notification channels

6. Enhanced User Management 👥

# View password policies
password-policy

# View active sessions
sessions

# Add user with password validation
# (Requires: min 8 chars, uppercase, lowercase, numbers, special chars)

Password Policy Features:

  • Minimum length enforcement
  • Complexity requirements (uppercase, lowercase, numbers, special chars)
  • Password expiry tracking (90 days default)
  • Failed login attempt monitoring
  • Session management

7. System State Export

# Export complete system snapshot
export

# Creates: data/system_snapshot_YYYYMMDD_HHMMSS.json
# Includes: metrics, processes, aliases, git branch, etc.

8. Cross-Platform Improvements

  • Windows readline support via pyreadline3
  • Better Windows CMD color handling
  • Platform-specific command adaptations

📊 Enhanced Architecture

NetMon-AI/
├── src/
│   ├── shell.py (⭐ ENHANCED)
│   │   ├── Piping & Redirection
│   │   ├── Git Branch Detection
│   │   ├── Command Aliases
│   │   ├── Advanced Autocomplete
│   │   └── Persistent History
│   │
│   ├── core/
│   │   ├── user_manager.py (⭐ ENHANCED)
│   │   │   ├── Password Validation
│   │   │   ├── Session Management
│   │   │   └── Policy Enforcement
│   │   │
│   │   ├── alerting.py (🆕 NEW)
│   │   │   ├── Multi-channel Alerts
│   │   │   ├── Threshold Management
│   │   │   ├── Alert History
│   │   │   └── Suppression Logic
│   │   │
│   │   └── (existing modules...)
│   │
│   └── data/ (🆕 NEW)
│       ├── command_history.json
│       ├── aliases.json
│       ├── alert_config.json
│       ├── alert_history.json
│       ├── password_policies.json
│       └── user_sessions.json

🎯 Usage Examples

Example 1: Set up custom workflows

# Create aliases for common tasks
alias checkhealth "health"
alias viewlogs "cat /var/log/syslog | search error"
alias backup "export"

# Use them
checkhealth
viewlogs
backup

Example 2: Monitor and alert

# Configure alerts for your thresholds
set-threshold cpu 70 85
set-threshold memory 75 90
set-threshold disk 80 95

# Check health (triggers alerts if needed)
health

# View recent alerts
alerts 10

Example 3: User management

# View password requirements
password-policy

# Add user (will validate password)
ask "add user john"

# View active sessions
sessions

Example 4: Advanced file operations

# Search logs
search "failed" /var/log/auth.log

# Chain commands with pipes
pslist | search python > python_processes.txt

# View file
cat python_processes.txt

🔒 Security Enhancements

  1. Password Strength Validation

    • Minimum 8 characters
    • Requires uppercase, lowercase, numbers, special chars
    • Customizable via policies
  2. Session Tracking

    • Track all active user sessions
    • Session timeouts
    • Login attempt monitoring
  3. Alert Suppression

    • Prevents alert flooding
    • 5-minute deduplication window
    • Configurable per alert type
  4. Audit Trail

    • All alerts logged to file
    • Command history preserved
    • Session activities tracked

📈 Performance Improvements

  • Efficient history management (last 1000 commands)
  • Optimized alert checking with suppression
  • Cached configuration loading
  • JSON-based persistent storage

🔮 Future Enhancements Roadmap

High Priority

  • Web Dashboard UI (Flask + React)
  • Database integration (SQLite/PostgreSQL)
  • Predictive analytics with ML
  • Container monitoring (Docker/K8s)
  • REST API endpoints

Medium Priority

  • Email/Webhook alert integration
  • Multi-server monitoring
  • Plugin system
  • Backup/restore automation
  • Performance profiling

Nice to Have

  • Mobile app
  • Voice commands
  • Multi-language support
  • Grafana integration
  • Custom themes

📝 Changelog

Version 1.1.0 (February 9, 2026)

  • ✅ Added piping and redirection support
  • ✅ Implemented Git branch detection in prompt
  • ✅ Added command aliases system
  • ✅ Enhanced command history with persistence
  • ✅ Improved tab completion
  • ✅ Added file operations (search, cat, touch)
  • ✅ Implemented system health scoring
  • ✅ Created intelligent alerting system
  • ✅ Enhanced user management with password policies
  • ✅ Added session management
  • ✅ Implemented system state export
  • ✅ Cross-platform improvements

Version 1.0.0 (February 1, 2026)

  • Initial release with AI integration
  • Basic monitoring and management features

🙏 Acknowledgments

This project combines features from multiple shell implementations and incorporates best practices from:

  • Linux system administration
  • DevOps monitoring tools
  • AI-powered assistants
  • Modern shell experiences (zsh, fish)

Made with ❤️ by Muhammad Asad (BIT22031)
University of the Punjab, Gujranwala Campus