Metadata-Version: 2.5
Name: lupaxa-sysinfo
Version: 0.1.5
Summary: Cross-platform system inventory library and CLI with modular collectors, redaction, and JSON/YAML/XML/HTML reports.
Project-URL: Homepage, https://github.com/lupaxa-developers-toolbox/sysinfo
Project-URL: Repository, https://github.com/lupaxa-developers-toolbox/sysinfo
Project-URL: Issues, https://github.com/lupaxa-developers-toolbox/sysinfo/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,inventory,psutil,sysinfo,system-info
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: distro>=1.8; sys_platform == 'linux'
Requires-Dist: psutil>=5.9
Requires-Dist: pyyaml>=6.0
Requires-Dist: tldextract>=5.0
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pip-audit>=2.7.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-developers-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/developers-toolbox/readme-logo.png" alt="Developers Toolbox" />
  </a>
</p>

<h1 align="center">Sysinfo</h1>

Cross-platform system inventory for Linux, macOS, and Windows — modular
collectors, granular redaction, and JSON / YAML / XML / HTML reports.

## Install

```bash
pip install lupaxa-sysinfo
sysinfo --help
```

You can also run `python -m lupaxa.sysinfo`.

## Features

-   Lightweight defaults: basic host info as pretty-printed JSON
-   Opt-in collectors: CPU, memory, disks, network, listening ports, processes,
  firewall, runtimes, GPU, packages, services, hosts/DNS, logs, storage,
  extra hardware, and package-manager layouts
-   Granular redaction for hosts, users, homes, emails, IPs, MACs, secrets,
  domains, and custom regexes
-   Profiles for common workflows: `minimal`, `ci`, `support`
-   JSON, YAML, XML, human summary, and compact HTML output (CLI)

## Safe Defaults

-   Only basic info is collected unless you enable sections or a profile
-   Environment variables require explicit `--env`; `--all` and every profile
  leave them off (they often hold credentials)
-   In the CLI, redaction is opt-in: raw output unless you pass `--redact-all`
  or individual `--redact-*` flags
-   In the library, `collect_report()` redacts by default; pass `redact=False`
  or a custom `RedactOptions` to change that
-   Missing OS tools are skipped, or normalized with `--strict-missing`
-   Platform tools (`nft`, `brew`, `systemctl`, …) are used only when present;
  the package never installs OS packages

## Requirements

- Python 3.10+
- Runtime: `psutil`, `PyYAML`, `tldextract` (plus `distro` on Linux)

## Library Quick Start

```python
from lupaxa.sysinfo import collect_report

report = collect_report(cpu=True, memory=True)
```

Reports are plain dictionaries with `schema_version` and `tool_version`,
ready for JSON serialisation. Use `CollectOptions` / `RedactOptions` (or the
`redact=` argument) when you need finer control than keyword flags.

## Redaction

Redaction runs **after collection and before any stdout or file write**. Use
it whenever a report might leave your machine.

**CLI vs library defaults (easy to miss):**

| Surface | Default                         | Shareable dumps                                       |
| ------- | ------------------------------- | ----------------------------------------------------  |
| CLI     | **Off** (raw output)            | Pass `--redact-all` (or selective `--redact-*` flags) |
| Library | **On** via `collect_report()`   | Already redacted; use `redact=False` only if you must |

Categories include FQDNs, hosts, users, homes, Windows homes, emails, IPv4/IPv6,
MACs, secrets, domains, domain trees, subdomains, and custom regexes. Secrets
mode masks dict values whose keys look secret-like (`KEY`, `TOKEN`,
`PASSWORD`, …).

```bash
# Full redaction for a support dump
sysinfo --profile support --redact-all \
  --json sysreport.json --html sysreport.html

# Selective categories, or carve one out after --redact-all
sysinfo --all --redact-emails --redact-hosts --redact-ipv4s
sysinfo --all --redact-all --no-redact-macs

# Explicit tokens and custom patterns
sysinfo --redact-email "admin@example.com"
sysinfo --redact-domain-trees --redact-domain-tree foo.bar.example.co.uk
sysinfo --redact-custom \
  --redact-rx "[A-Za-z0-9]{32}" \
  --redact-file patterns.txt
```

```python
from lupaxa.sysinfo import collect_report, RedactOptions

# Library default: redacted (all categories on)
report = collect_report(cpu=True, memory=True)

# Keep redaction but carve out a category
report = collect_report(cpu=True, redact=RedactOptions(macs=False))

# Raw (local debugging only)
raw = collect_report(cpu=True, redact=False)
```

If you enable `--env`, always pair it with redaction before sharing:

```bash
sysinfo --profile support --env --redact-all --yaml support.yaml
```

## CLI Quick Start

```bash
sysinfo
sysinfo --version
sysinfo --profile ci --json report.json
sysinfo --all --yaml report.yaml
sysinfo --all --output xml
sysinfo --profile support --xml report.xml
```

### Profiles

| Profile   | Behaviour                                                              |
| --------- | ---------------------------------------------------------------------- |
| `minimal` | Basic only; spinner off                                                |
| `ci`      | CPU, memory, disks, network, runtimes, packages (fast); strict missing |
| `support` | All non-environment sections; full package enumeration                 |

### Common Recipes

```bash
sysinfo --profile ci --json ci-sysinfo.json
sysinfo --cpu --memory
sysinfo --all --no-firewall --no-gpu
sysinfo --packages --packages-mode fast
```

Stdout formats are `json` (default), `yaml`, `xml`, `summary`, and `both`.
File writers: `--json PATH`, `--yaml PATH`, `--xml PATH`, `--html PATH`.
Full flag list: `sysinfo --help`.

## Development

From a clone of this repository:

```bash
make init                # first-time makefile-skills checkout
make python-install-dev  # editable install with [dev]
make python-check        # lint, type-check, and test
```

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
