๐ฆ Rex โ A Swiss Army Knife CLI for DevOps Engineers
Project description
๐ฆ Rex
A Swiss Army Knife CLI for DevOps Engineers
Encrypt secrets, lint configs, generate passwords, inspect certificates โ all from your terminal.
Installation ยท Quick Start ยท Commands ยท Contributing
โก Installation
# From PyPI
pip install rex-cli
# With JMESPath query support
pip install rex-cli[query]
# From source
git clone https://github.com/DavidHayter/rex-cli.git
cd rex-cli
pip install -e ".[dev]"
Verify installation:
rex version
๐ Quick Start
# Encrypt a secret
rex encrypt enc "my-database-password" -p
# Beautify a JSON file
rex json beautify --file config.json --output pretty.json
# Lint your Kubernetes YAML
rex yaml lint deployment.yaml
# Generate a secure password
rex password generate --length 32
# Explain a cron expression
rex cron explain "*/5 9-17 * * 1-5"
# Hash a file
rex hash generate --file backup.tar.gz --all
# Check SSL certificate expiry
rex cert expiry example.com
# Scan open ports
rex net port 192.168.1.1 22,80,443,8080
๐ Commands
๐ rex encrypt โ Encryption & Decryption
Encrypt and decrypt data using industry-standard algorithms with password-based key derivation (PBKDF2, 480k iterations).
# Encrypt with AES-256-GCM (default)
rex encrypt enc "sensitive data" -p
> Enter password: ****
# Encrypt with ChaCha20-Poly1305
rex encrypt enc "sensitive data" -p --algo chacha20-poly1305
# Encrypt a file
rex encrypt enc -p --file secrets.env --output secrets.enc
# Decrypt
rex encrypt dec "eyJhbGci..." -p
# List supported algorithms
rex encrypt algorithms
| Algorithm | Description |
|---|---|
aes-256-gcm |
Default. NIST standard, authenticated encryption |
chacha20-poly1305 |
Fast on devices without AES hardware support |
fernet |
High-level symmetric encryption (AES-128-CBC + HMAC) |
๐ rex json โ JSON Operations
# Beautify
rex json beautify '{"name":"rex","version":1}' --indent 4
# Beautify from file and save
rex json beautify --file raw.json --output pretty.json
# Minify
rex json minify --file config.json
# Validate
rex json validate --file package.json
# Query with JMESPath (requires: pip install rex-cli[query])
cat data.json | rex json query "users[?age > `30`].name"
๐ rex yaml โ YAML Operations
# Lint a YAML file
rex yaml lint deployment.yaml
# Strict mode (warns on tabs, trailing whitespace)
rex yaml lint values.yaml --strict
# Convert YAML to JSON
rex yaml to-json --file values.yaml --output values.json
# Convert JSON to YAML
rex yaml to-yaml --file config.json --output config.yaml
# Validate YAML syntax
rex yaml validate "key: value"
๐ rex password โ Password Generation
# Generate a 24-char password (default)
rex password generate
# Custom length, multiple passwords
rex password generate --length 48 --count 5
# No symbols
rex password generate --length 16 --no-symbols
# Exclude ambiguous characters
rex password generate --exclude "0OlI1"
# Generate a passphrase
rex password passphrase --words 6 --separator "-"
# Capitalized passphrase
rex password passphrase --words 5 --capitalize --separator "."
โฐ rex cron โ Cron Expressions
# Explain a cron expression
rex cron explain "30 2 * * 0"
# Show all presets
rex cron presets
# Use a preset
rex cron generate daily
rex cron generate backup-nightly
rex cron generate business-hours
# Build custom expression
rex cron generate --minute "*/15" --hour "9-17" --weekday "1-5"
DevOps-focused presets: health-check, backup-nightly, cleanup-weekly, log-rotation, cert-renewal, and more.
๐ rex hash โ Hash Generation
# SHA-256 hash (default)
rex hash generate "hello world"
# All algorithms at once
rex hash generate "hello world" --all
# Hash a file
rex hash generate --file backup.tar.gz --algo sha512
# HMAC
rex hash hmac "message" --key "my-secret" --algo sha256
# Verify a hash
rex hash verify "hello" --expected "2cf24dba..."
| Algorithm | Output Length |
|---|---|
md5 |
128-bit |
sha1 |
160-bit |
sha256 |
256-bit |
sha512 |
512-bit |
blake2b |
512-bit |
blake2s |
256-bit |
๐ฆ rex base64 โ Base64 Operations
# Encode
rex base64 encode "hello world"
# Decode
rex base64 decode "aGVsbG8gd29ybGQ="
# URL-safe encoding
rex base64 encode "https://example.com?q=test" --url-safe
# File operations
rex base64 encode --file image.png --output image.b64
rex base64 decode --file image.b64 --output restored.png
# Pipe support
echo "secret" | rex base64 encode
๐ซ rex jwt โ JWT Token Inspection
# Decode a JWT
rex jwt decode "eyJhbGciOiJIUzI1NiIs..."
# Pipe from clipboard
pbpaste | rex jwt decode
# Shows:
# - Header (algorithm, type)
# - Payload (all claims)
# - Expiry status (VALID / EXPIRED)
# - Issued at, subject, issuer, audience
๐ rex uuid โ UUID Generation
# Generate UUID v4 (random)
rex uuid generate
# Multiple UUIDs
rex uuid generate --count 10
# UUID v1 (timestamp-based)
rex uuid generate --version 1
# UUID v5 (namespace + name)
rex uuid generate --version 5 --name "example.com"
# Uppercase
rex uuid generate --upper
๐ rex cert โ SSL/TLS Certificate Inspection
# Full certificate details
rex cert inspect google.com
# Check expiry (great for monitoring scripts)
rex cert expiry google.com
rex cert expiry --warn 60 production-api.company.com
# Custom port
rex cert inspect mail.example.com --port 465
Exit codes for cert expiry (perfect for monitoring):
0โ Certificate is valid1โ Certificate expiring soon (within --warn days)2โ Certificate expired or connection failed
๐ rex net โ Network Utilities
# DNS lookup
rex net dns example.com
rex net dns example.com --type MX
rex net dns example.com --type TXT
# Port scanning
rex net port 192.168.1.1 22,80,443
rex net port server.com 8000-8010
# Ping
rex net ping 8.8.8.8
rex net ping google.com --count 10
๐ง Pipe Support
Rex supports Unix pipes across all commands:
# Chain commands
echo '{"key":"value"}' | rex json beautify
cat config.yaml | rex yaml to-json
echo "secret" | rex base64 encode
echo "secret" | rex hash generate --all
pbpaste | rex jwt decode
๐งช Development
# Clone and install
git clone https://github.com/DavidHayter/rex-cli.git
cd rex-cli
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=rex --cov-report=html
# Lint
ruff check rex/
ruff format rex/
# Type check
mypy rex/
๐ฆ Project Structure
rex-cli/
โโโ rex/
โ โโโ __init__.py # Version & metadata
โ โโโ cli.py # Main CLI entry point
โ โโโ commands/
โ โโโ encrypt_cmd.py # Encryption & decryption
โ โโโ json_cmd.py # JSON operations
โ โโโ yaml_cmd.py # YAML operations
โ โโโ password_cmd.py # Password generation
โ โโโ cron_cmd.py # Cron expressions
โ โโโ hash_cmd.py # Hash generation
โ โโโ base64_cmd.py # Base64 encode/decode
โ โโโ jwt_cmd.py # JWT inspection
โ โโโ uuid_cmd.py # UUID generation
โ โโโ cert_cmd.py # SSL/TLS inspection
โ โโโ network_cmd.py # Network utilities
โโโ tests/
โ โโโ test_cli.py # Test suite
โโโ pyproject.toml # Package configuration
โโโ LICENSE # MIT License
โโโ CHANGELOG.md # Version history
โโโ README.md # This file
๐บ๏ธ Roadmap
-
rex k8sโ Kubernetes context switcher & resource inspector -
rex dockerโ Docker image size analyzer & cleanup -
rex envโ .env file encryption & diff -
rex tfโ Terraform state inspector -
rex logโ Log parser with pattern matching - Plugin system for community extensions
๐ License
MIT โ see LICENSE for details.
Built with ๐ฆ by Merthan
If Rex saved you some time, consider giving it a โญ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rex_cli-1.0.0.tar.gz.
File metadata
- Download URL: rex_cli-1.0.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
080939aea20bbe91bfad33d41ca8962b584d553722410c6022b995016ccb5434
|
|
| MD5 |
dc51033c882fbc82b6ae449bf6538648
|
|
| BLAKE2b-256 |
ce4b8949f16cee40d155280b1b85efdeaca5078484eeadba7b1b137e9e0db0ff
|
Provenance
The following attestation bundles were made for rex_cli-1.0.0.tar.gz:
Publisher:
publish.yml on DavidHayter/rex-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rex_cli-1.0.0.tar.gz -
Subject digest:
080939aea20bbe91bfad33d41ca8962b584d553722410c6022b995016ccb5434 - Sigstore transparency entry: 982324733
- Sigstore integration time:
-
Permalink:
DavidHayter/rex-cli@51a89e7830e73cf907f6820a7561da23ae2060af -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/DavidHayter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@51a89e7830e73cf907f6820a7561da23ae2060af -
Trigger Event:
release
-
Statement type:
File details
Details for the file rex_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rex_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175da537ac1a0354b965a3e00455d15f153d7eea898f9cbeeab0a1ab3557fd25
|
|
| MD5 |
3f4187db29beb45cebe42614b435d47f
|
|
| BLAKE2b-256 |
dd66d5a08b29e1ba3d765558ad4d312544775b8855905c755ad77a5cbfed1411
|
Provenance
The following attestation bundles were made for rex_cli-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on DavidHayter/rex-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rex_cli-1.0.0-py3-none-any.whl -
Subject digest:
175da537ac1a0354b965a3e00455d15f153d7eea898f9cbeeab0a1ab3557fd25 - Sigstore transparency entry: 982324749
- Sigstore integration time:
-
Permalink:
DavidHayter/rex-cli@51a89e7830e73cf907f6820a7561da23ae2060af -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/DavidHayter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@51a89e7830e73cf907f6820a7561da23ae2060af -
Trigger Event:
release
-
Statement type: