Skip to main content

pinspect — Linux Process Intelligence CLI

Fast, deep Linux process inspection and forensic intelligence tool that goes far beyond ps aux.

PyPI version Python versions License: MIT

pinspect is an all-in-one terminal tool designed for systems engineers, SREs, and security investigators. It collects deep, actionable intelligence about running processes directly from native Linux /proc and kernel interfaces with zero external command dependencies, low overhead, graceful error recovery, and rich terminal and SIEM/EDR output formats.


📦 Installation

Install directly from PyPI:

pip install pinspect-cli

Or install with pipx (isolated environment):

pipx install pinspect-cli

Or run from source:

git clone https://github.com/Baba01hacker666/pinspect.git
cd pinspect
pip install -e .

⚡ Key Highlights

  • Complete Process Visibility: PID, PPID, ancestry chain to PID 1, command line, arguments, executable, working directory, root directory (with chroot detection), start time, real/effective/saved/fs UIDs & GIDs, supplementary groups, session ID, process group, and TTY.
  • Launch & Origin Intelligence: Automatically detects whether a process originated from systemd, cron, SSH, an interactive shell, Docker, Podman, Kubernetes, a supervisor (e.g. runsv, supervisord), or the kernel. Resolves systemd service unit names, unit files on disk, and container IDs.
  • Security & Privilege Forensics: Decodes 64-bit Linux capability bitmasks (CapEff, CapPrm, CapInh, CapBnd, CapAmb) to named capabilities (CAP_SYS_ADMIN, CAP_NET_RAW), checks NoNewPrivs, Seccomp filters, AppArmor/SELinux contexts, SetUID/SetGID bits, executable SHA-256 hashes, and unlinked binary execution ((deleted) executables & memory mappings).
  • Files & Sockets: Inspects open file descriptors, target classification (regular files, pipes, unix sockets, network sockets, anon inodes), permissions, file size, deleted files held in memory, and system-wide/per-PID network connections.
  • Secret Redaction: pinspect env automatically discovers and masks sensitive secrets and credentials (*_TOKEN, *_KEY, *_SECRET, *_PASSWORD, AWS_*, DATABASE_URL, JWT tokens, and private keys).
  • Process Hierarchy Tree: Visualizes process trees with color-coded states, CPU/memory stats, container badges, and ancestry lineages.
  • Interactive TUI: Built-in interactive dashboard with live filtering, sortable columns, and detailed multi-tab views.
  • SIEM / EDR Formats: Structured JSON output (--json), CSV export (--csv), wide (--wide), and quiet mode (--quiet).

📖 Command Reference

1. Process Listing (pinspect ps or pinspect)

Lists running processes with CPU, memory, origin, and state:

# Default process list
pinspect ps

# Filter by user or UID
pinspect ps --user root
pinspect ps --user 1000

# Filter by process name (regex)
pinspect ps --name "nginx|caddy"

# Filter by listening or connected network port
pinspect ps --port 8080
pinspect ps --listen

# Filter by systemd service name
pinspect ps --service ssh

# Filter for containerized processes only
pinspect ps --container

# Filter for processes running deleted executables or open deleted files
pinspect ps --deleted

# Sort options (cpu, mem, pid, user, name, age)
pinspect ps --sort mem --limit 10

2. Process Tree (pinspect tree)

Renders hierarchical process tree:

# Full system tree
pinspect tree

# Subtree rooted at a specific PID
pinspect tree 1234

# Highlight a specific PID in the tree
pinspect tree --highlight 1234

3. Detailed Process Inspection (pinspect show <PID>)

Displays comprehensive intelligence card for a single PID:

# Show identity, origin, CPU/mem stats, security, namespaces, ancestry
pinspect show 14847

# Include SHA-256 binary hash
pinspect show 14847 --hash

4. Open Files & Descriptors (pinspect files <PID>)

Inspects open FDs, targets, inode numbers, and deleted files:

pinspect files 14847

# Show only deleted files held open by process
pinspect files 14847 --deleted

# Filter by type (regular, socket, pipe, anon, char)
pinspect files 14847 --type socket

5. Network Sockets (pinspect network [PID])

Inspects TCP, UDP, and Unix domain sockets mapped to processes:

# All network sockets on the host
pinspect network

# Network sockets for a specific PID
pinspect network 14847

# Filter by port and protocol
pinspect network --port 443 --proto TCP --listen

6. Environment Variables (pinspect env <PID>)

Inspects process environment variables with automatic secret redaction:

# Redacted view (default)
pinspect env 14847

# Search variable names
pinspect env 14847 --filter TOKEN

# Unredacted view (explicit authorization)
pinspect env 14847 --show-secrets

7. Process Ancestry & Children (pinspect ancestry / pinspect children)

Inspects process lineage chains:

# Full ancestor chain from PID 1 / init down to the process
pinspect ancestry 14847

# Subtree of children and descendants
pinspect children 14847

8. Namespaces (pinspect namespaces <PID>)

Compares namespace inodes against host/PID 1:

pinspect namespaces 14847

9. Security & Capability Forensics (pinspect security <PID>)

Inspects Linux capabilities, Seccomp, NoNewPrivs, LSM, and file integrity:

pinspect security 14847

10. Interactive TUI Mode (pinspect tui)

Launches full-screen interactive dashboard:

pinspect tui

Interactive Keybindings:

  • / / k / j: Navigate process list
  • PgUp / PgDn / Home / End: Fast scroll
  • Enter: Open process detail pane (tabs: Overview, Files, Network, Security, Env)
  • /: Search / Filter processes in real time
  • s: Cycle sort columns (CPU, MEM, PID, USER, NAME)
  • r: Refresh process list
  • q / ESC: Back / Quit

📊 SIEM / EDR Output Formats

Every subcommand supports structured serialization:

# Structured JSON for SIEM / EDR pipelines
pinspect ps --json
pinspect show 1234 --json
pinspect network --json
pinspect security 1234 --json

# CSV for data analysis & spreadsheets
pinspect ps --csv
pinspect files 1234 --csv
pinspect network --csv

# Quiet mode (machine-parseable PIDs or values)
pinspect ps --user nginx --quiet

🧪 Testing

Comprehensive test suite with full mocked /proc filesystem fixtures:

python3 -m unittest discover -s tests -p "test_*.py" -v

📜 Publishing to PyPI

To publish a new release to PyPI:

# 1. Build distribution archives
rm -rf dist/
python3 -m build

# 2. Verify with twine
twine check dist/*

# 3. Upload to PyPI
twine upload dist/*

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinspect_cli-1.0.0.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinspect_cli-1.0.0-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file pinspect_cli-1.0.0.tar.gz.

File metadata

  • Download URL: pinspect_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pinspect_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ff6b4d0f51e9c58a025901e0208d5daa001a4c357af7bf31843fc78ed87ed025
MD5 6431007fc2fac8510118c0ed33bb31ca
BLAKE2b-256 81dc83b2df11ad5e7202e8fb90995892616ea897fdb0ada4b5b39738c71ce8c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinspect_cli-1.0.0.tar.gz:

Publisher: publish.yml on Baba01hacker666/pinspect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinspect_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pinspect_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pinspect_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c31b41f4941537067e60fe3f927ec81808024e97d5612945feef5f750aa914d
MD5 924ccccddcf52c3028c5f6dba727549e
BLAKE2b-256 62e698e275e08c88c994fee0b107144f09eafb6583a21f89b0abcffbadb24bae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinspect_cli-1.0.0-py3-none-any.whl:

Publisher: publish.yml on Baba01hacker666/pinspect

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.0.3

2 files

1.0.2

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page