Skip to content

A cross-platform process filtering and analysis tool with window detection support

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

YMC-GitHub/pscan

PScan - Process Scanning and Analysis Tool

Project Description

PScan is a cross-platform command-line tool for process filtering and analysis with advanced window detection capabilities. It provides multiple output formats and flexible filtering options to help developers and system administrators quickly locate and analyze system processes.

Project Value and Significance

🎯 Core Problems Solved

  • Quick Process Location: Rapidly find target processes among numerous system processes
  • Window Association Analysis: Identify which processes have graphical interface windows
  • Multi-format Output: Support for table, JSON, YAML, CSV, and other formats for easy integration with other tools
  • Cross-platform Compatibility: Runs on both Windows and Unix-like systems

💡 Application Scenarios

  • Finding specific processes when debugging applications
  • System resource monitoring and analysis
  • Automation script integration
  • Process management tool development

Features

🔍 Filtering Capabilities

  • PID Filter: Exact filtering by process ID
  • Name Filter: Fuzzy matching by process name (case-insensitive)
  • Title Filter: Fuzzy matching by window title (case-insensitive)
  • Window Status Filter: Filter processes with or without windows

📊 Output Formats

  • Table Format: Easy-to-read tabular output
  • JSON Format: Easy parsing by programs
  • YAML Format: Well-structured configuration format
  • CSV Format: Spreadsheet-compatible format
  • Simple Format: Concise single-line output
  • Detailed Format: Complete process information display

🖥️ Platform Support

  • Windows: Full window detection support
  • Linux/macOS: Basic process information support (window detection as placeholder)

Directory Structure

pscan/
├── Cargo.toml          # Project configuration and dependency management
├── Cargo.lock          # Dependency version locking
├── README.md           # Project documentation (Chinese)
├── README.en.md        # Project documentation (English)
└── src/                # source code

Module Dependency Diagram

Visual Dependency Flow

┌─────────┐    ┌─────────┐    ┌──────────┐
│  main   │───▶│   cli   │───▶│  output  │
└─────────┘    └─────────┘    └──────────┘
     │              │              │
     ▼              ▼              ▼
┌─────────┐    ┌─────────┐    ┌──────────┐
│process  │───▶│ types   │◀───│  output  │
└─────────┘    └─────────┘    └──────────┘
     │
     ▼
┌─────────┐
│ window  │
└─────────┘

Detailed Dependency Table

Module Dependencies Used By
main.rs cli, process, output, types (Entry Point)
cli.rs output::OutputFormat main.rs
process.rs types::ProcessInfo, window main.rs
output.rs types::{ProcessInfo, ProcessOutput} main.rs, cli.rs
types.rs (None) main.rs, process.rs, output.rs
window.rs (None) process.rs

Functional Responsibilities

  • main.rs: Coordinates the entire application workflow
  • cli.rs: Parses command line arguments and configuration
  • process.rs: Enumerates, filters, and manages process information
  • window.rs: Platform-specific window detection functionality
  • output.rs: Multiple format data output and display
  • types.rs: Defines core data structures and conversions

Key Features

  1. No Circular Dependencies: All dependencies are unidirectional
  2. Clear Hierarchy: Clear layers from bottom (window/types) to top (main)
  3. Separation of Responsibilities: Each module has clear single responsibility
  4. Easy Testing: Loose coupling between modules facilitates unit testing

Installation Guide

Prerequisites

  • Rust programming environment (version 1.70.0 or higher)
  • Cargo package manager

Installation Steps

  1. Install from Source
# Clone the project
git clone https://github.com/ymc-github/pscan.git
cd pscan

# Build and install
cargo install --path .
  1. Install from Crates.io (after publication)
cargo install pscan
  1. Run Locally
# Run in development mode
cargo run -- --help

# Run in release mode
cargo run --release -- --help

Usage Examples

Basic Usage

# View all processes (table format)
pscan

# View detailed process information
pscan --verbose

# Filter by process name
pscan --name "chrome"

# Filter by window title
pscan --title "Visual Studio"

# Show only processes with windows
pscan --has-window

Filtering Examples

# Exact search by PID
pscan --pid 1234

# Combined filtering: processes with name containing "code" and having windows
pscan --name "code" --has-window

# Show processes without windows
pscan --no-window

Output Format Examples

# JSON format output
pscan --format json

# YAML format output
pscan --format yaml

# CSV format output (suitable for Excel import)
pscan --format csv

# Simple format output
pscan --format simple

# Detailed format output
pscan --format detailed

Advanced Usage

# Combine filtering and output formats
pscan --name "firefox" --has-window --format json

# Table output in verbose mode
pscan --verbose --format table

# Pipeline processing: find Chrome processes and count them
pscan --name "chrome" --format simple | wc -l

Output Description

Table Columns

  • PID: Process ID
  • Name: Process name
  • Title: Window title or fallback title
  • Memory: Memory usage (MB)
  • Window: Whether has window (shown only in verbose mode)

Memory Units

  • Memory usage automatically converted to MB
  • Raw memory usage in bytes (shown in detailed output)

Development Guide

Project Architecture

  • main.rs: Handles command-line parsing, process collection, and filtering logic
  • output.rs: Handles all output format rendering and display

Extension Development

To add new output formats, add corresponding handling in the OutputFormat enum and display_processes function in output.rs.

Troubleshooting

Common Issues

  1. Window Detection Not Working (Non-Windows Systems)

    • Currently, window detection is fully supported only on Windows systems
    • Other systems will display warning messages
  2. Permission Issues

    • Administrator privileges may be required on some systems to access all process information
  3. Incomplete Process Information

    • Some processes may not provide complete command-line or path information

Author Information

Developer: YeMiancheng
Email: [email protected]
GitHub: ymc-github

License Information

This project is dual-licensed under:

  • MIT License
  • Apache License 2.0

You may choose either license according to your needs.

Contributing

Issues and Pull Requests are welcome to help improve this project!

Changelog

v0.1.0

  • Initial version release
  • Basic process filtering functionality
  • Multi-format output support
  • Windows window detection feature

About

A cross-platform process filtering and analysis tool with window detection support

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published