Skip to content

About

Comprehensive CLI infrastructure health scanner for Ubuntu servers. Features beautiful terminal UI with 9 specialized modules: system info, security audit, resource monitoring, network scanning, package vulnerabilities, Docker status, log analysis, and process monitoring. Python-based, read-only, local scanning tool for DevOps and sysadmins.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ServerScan - Infrastructure Health Scanner

A comprehensive CLI-based infrastructure health scanner for Ubuntu servers. This tool performs deep system analysis including security audits, resource monitoring, network scanning, and more - all from a beautiful terminal interface.

Features

Interactive Menu-Driven Interface

  • Beautiful colored terminal output using Rich library
  • Easy-to-navigate menu system
  • Real-time progress indicators
  • Comprehensive reporting

Scanning Modules

  1. Full System Scan - Runs all modules and provides overall health score
  2. System Information - OS, hardware, CPU, memory, and disk information
  3. Security Audit - Firewall, SSH config, failed logins, SUID binaries, open ports
  4. Resource Monitor - CPU, RAM, swap usage, top processes
  5. Network & Ports Scan - Network interfaces, listening ports, active connections
  6. Package & Vulnerabilities - Package status, security updates, OS version
  7. Docker Status - Container and image information
  8. Log Analysis - Authentication logs, system errors, disk warnings
  9. Process Monitor - Running processes, zombie detection, resource usage

Installation

Prerequisites

  • Ubuntu 18.04 or later (tested on Ubuntu 20.04/22.04)
  • Python 3.6 or later
  • Root/sudo access for full functionality

Quick Install

# Clone or download the project
cd server-scanner

# Install required Python packages
pip3 install -r requirements.txt

# Make the scanner executable
chmod +x scanner.py

# Run the scanner
sudo ./scanner.py

Manual Installation

# Install Python dependencies
pip3 install rich==13.7.0

# Ensure the following system tools are available (usually pre-installed):
# - ss (iproute2)
# - ps (procps)
# - df, free (coreutils)
# - dmidecode (for hardware detection)
# - apt (package management)

Usage

Interactive Mode (Default)

Simply run the scanner and choose from the menu:

sudo ./scanner.py

Menu Options

╔════════════════════════════════════════════════════════════╗
║              SERVER HEALTH SCANNER v1.0                    ║
║           Comprehensive Infrastructure Monitor            ║
╚════════════════════════════════════════════════════════════╝

[1] Full System Scan (Run Everything)
[2] System Information Only
[3] Security Audit
[4] Resource Monitor (CPU/RAM/Disk)
[5] Network & Ports Scan
[6] Package & Vulnerabilities
[7] Docker Status
[8] Log Analysis
[9] Process Monitor
[0] Exit

What Each Module Scans

System Information (Option 2)

  • Operating System version and kernel
  • Hostname and uptime
  • Architecture (x86_64, ARM, etc.)
  • Platform detection (Physical hardware, VMware, VirtualBox, KVM)
  • CPU model, cores, and current usage
  • RAM and swap usage with visual indicators
  • Disk usage for all mounted filesystems

Security Audit (Option 3)

  • Firewall status (UFW, iptables, firewalld)
  • SSH configuration (root login, password auth, custom port)
  • Failed SSH login attempts
  • Security modules (AppArmor, SELinux)
  • World-writable files detection
  • Users with UID 0
  • Empty password users
  • Open ports with risk assessment
  • SUID/SGID binary detection

Resource Monitor (Option 4)

  • Real-time CPU usage with visual bars
  • Memory (RAM) usage and availability
  • Swap usage
  • System load average (1, 5, 15 min)
  • Top 5 CPU-consuming processes
  • Top 5 memory-consuming processes
  • Disk I/O statistics

Network & Ports Scan (Option 5)

  • Network interfaces with IP addresses and status
  • Link speed for physical interfaces
  • All listening ports (TCP/UDP)
  • Process information for each port
  • Active network connections
  • Routing table

Package & Vulnerabilities (Option 6)

  • Total installed packages count
  • Available package updates
  • Pending security updates (CRITICAL)
  • Unattended-upgrades status
  • Last update timestamp
  • OS version and support status
  • Kernel update availability

Docker Status (Option 7)

  • Docker version and daemon status
  • Docker socket permission check
  • Running and stopped containers
  • Container resource usage
  • Docker images with sizes
  • Docker networks and volumes count

Log Analysis (Option 8)

  • Successful and failed SSH login attempts
  • Recent failed login details (IP, user, count)
  • Sudo command usage
  • System errors in syslog
  • Out of Memory (OOM) events
  • Systemd service failures
  • Disk space warnings
  • I/O errors
  • Network interface events

Process Monitor (Option 9)

  • Process overview (total, running, sleeping, stopped, zombie)
  • Zombie process detection and listing
  • Top processes by CPU and memory
  • High CPU usage processes (>10%)
  • High memory usage processes (>5%)
  • Process count by user
  • Long-running processes

Full System Scan (Option 1)

Runs all modules sequentially and provides:

  • Overall health score (0-100)
  • Critical issues summary
  • Warnings summary
  • Good status items
  • Comprehensive system report

Security Considerations

Required Permissions

Many scanning features require root/sudo access:

  • Reading system logs (/var/log/*)
  • Accessing network information
  • Reading security-sensitive files
  • Hardware information via dmidecode

Always run with sudo:

sudo ./scanner.py

What This Tool Does NOT Do

  • Does NOT modify any system settings
  • Does NOT install or remove packages
  • Does NOT restart services
  • Does NOT make firewall changes
  • Read-only analysis and reporting only

Privacy

  • All scanning is local - no data sent externally
  • No telemetry or analytics
  • Results stay on your system unless you export them

Troubleshooting

"Permission denied" errors

Run with sudo: sudo ./scanner.py

"ModuleNotFoundError: No module named 'rich'"

Install dependencies: pip3 install -r requirements.txt

Docker module shows "Not installed"

Docker is optional. Install with: sudo apt install docker.io

Some log analysis features return "0" or "Unknown"

Check that log files exist and are readable:

ls -la /var/log/auth.log
ls -la /var/log/syslog

Hardware detection shows "Unknown"

Install dmidecode: sudo apt install dmidecode

Project Structure

server-scanner/
├── scanner.py              # Main entry point
├── requirements.txt        # Python dependencies
├── README.md              # This file
├── modules/               # Scanning modules
│   ├── __init__.py
│   ├── system_info.py     # System information
│   ├── security.py        # Security audit
│   ├── resources.py       # Resource monitoring
│   ├── network.py         # Network scanning
│   ├── packages.py        # Package management
│   ├── docker.py          # Docker status
│   ├── logs.py            # Log analysis
│   ├── processes.py       # Process monitoring
│   └── full_scan.py       # Full system scan
└── utils/                 # Utility functions
    ├── __init__.py
    ├── display.py         # Rich formatting
    └── helpers.py         # Command execution

Technical Details

Architecture

  • Language: Python 3
  • UI Framework: Rich (terminal formatting)
  • System Commands: Pure bash via subprocess
  • No external APIs: Everything runs locally

Design Philosophy

  • Minimal external dependencies
  • Use built-in Linux commands
  • Beautiful, professional CLI output
  • Modular architecture for easy extension
  • Read-only, non-invasive scanning

Tested On

  • Ubuntu 20.04 LTS
  • Ubuntu 22.04 LTS
  • Ubuntu 24.04 LTS
  • Debian 11/12 (should work)

Portfolio Use

This project demonstrates:

  • Python programming and system administration
  • Linux command-line tools expertise
  • Security awareness and best practices
  • Clean, maintainable code architecture
  • Professional CLI application development
  • Infrastructure monitoring knowledge
  • DevOps skills

Future Enhancements

Potential additions for v2.0:

  • Save reports to JSON/TXT files
  • Remote server scanning via SSH
  • Scheduled scanning with cron
  • Email alerts for critical issues
  • Historical trend analysis
  • Custom alert thresholds
  • Export to CSV/PDF
  • Service-specific health checks
  • Database performance analysis

Contributing

This is a portfolio project, but improvements are welcome:

  • Bug reports
  • Feature suggestions
  • Code improvements
  • Documentation updates

License

Free to use for educational and portfolio purposes.

Author

Created as a DevOps portfolio project demonstrating infrastructure monitoring and system administration skills.

Acknowledgments

  • Built with Rich for beautiful terminal output
  • Inspired by tools like htop, netstat, and various system monitoring utilities
  • Thanks to the Ubuntu/Debian community for excellent documentation

Note: This tool is designed for legitimate system administration and educational purposes only. Always ensure you have proper authorization before scanning any system.

About

Comprehensive CLI infrastructure health scanner for Ubuntu servers. Features beautiful terminal UI with 9 specialized modules: system info, security audit, resource monitoring, network scanning, package vulnerabilities, Docker status, log analysis, and process monitoring. Python-based, read-only, local scanning tool for DevOps and sysadmins.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages