Metadata-Version: 2.5
Name: cn-tool
Version: 0.15.1
Summary: Infoblox lookups and network checks from a menu or the command line
Project-URL: Homepage, https://github.com/evdanil/cn-tool
Project-URL: Source, https://github.com/evdanil/cn-tool
Project-URL: Issues, https://github.com/evdanil/cn-tool/issues
Project-URL: Changelog, https://github.com/evdanil/cn-tool/releases
Author-email: Evgeny Danilchenko <evgeny@netsectech.com.au>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: cli,dhcp,dns,infoblox,ipam,network
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Networking
Requires-Python: >=3.10
Requires-Dist: click
Requires-Dist: diskcache
Requires-Dist: ldap3
Requires-Dist: netmiko<5
Requires-Dist: openpyxl
Requires-Dist: pandas<3,>=2.2.2; python_version < '3.11'
Requires-Dist: pandas==3.1.0; python_version >= '3.11'
Requires-Dist: python-dateutil
Requires-Dist: pyyaml
Requires-Dist: requests>=2.32.3
Requires-Dist: rich
Requires-Dist: textual<9,>=8.2
Provides-Extra: webui
Requires-Dist: keyring<26,>=25.7; extra == 'webui'
Requires-Dist: nicegui<3.19,>=3.18; extra == 'webui'
Requires-Dist: pydantic==2.14.2; (sys_platform == 'win32') and extra == 'webui'
Description-Content-Type: text/markdown

# cn-tool

[![PyPI version](https://img.shields.io/pypi/v/cn-tool)](https://pypi.org/project/cn-tool/)
[![Python versions](https://img.shields.io/pypi/pyversions/cn-tool)](https://pypi.org/project/cn-tool/)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/evdanil/cn-tool/blob/main/LICENSE)
[![Platforms: Linux, macOS, Windows](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey)](#requirements)

cn-tool looks up addresses, subnets, DNS names and sites in Infoblox, pings and monitors
hosts, and searches local device configurations. It is for network engineers and system
administrators, and has three interfaces over one configuration file: a local browser
interface, an interactive terminal menu and a command line for scripts.

<a id="local-subnets-interface"></a><a id="local-subnets-ip-and-ping-interface"></a>
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/evdanil/cn-tool/main/docs/images/webui-monitor-dark.png">
  <img src="https://raw.githubusercontent.com/evdanil/cn-tool/main/docs/images/webui-monitor-light.png" width="800"
       alt="The Monitor page of the browser interface: a map with one character for each monitored address, showing which hosts replied in the latest round">
</picture>

<a id="installation"></a><a id="from-pypi"></a><a id="first-run"></a>

## Quick start

```console
pip install "cn-tool[webui]"   # or: pipx install "cn-tool[webui]"
cn init                        # writes ~/.cn and never overwrites one
cn doctor                      # checks the configuration and the Infoblox connection
cn-web                         # opens the browser interface on 127.0.0.1
```

Between `cn init` and `cn doctor`, open `~/.cn` (`%USERPROFILE%\.cn` on Windows) and set
`endpoint` under `[api]` to the WAPI URL of your grid. Ping and Monitor work without Infoblox.
Without the `[webui]` extra you get the menu (`cn`) and the command line only.

**On Windows**, `cn-web --create-shortcut` adds a **cn-tool Web** shortcut to the Start menu and the
Desktop (`-c FILE` for another configuration file, `--console` to keep a console window). Where policy
(AppLocker, WDAC, antivirus) blocks `cn.exe` and `cn-web.exe`, start cn-tool through the signed
`python.exe` of the environment it is installed in; the commands and options are the same:

```console
python -m cn_tool.webui                     # instead of cn-web
python -m cn_tool.webui --create-shortcut   # a shortcut that starts the signed pythonw.exe
python -m cn_tool ip 10.1.2.3               # instead of cn ip 10.1.2.3
```

Use that environment's full path to `python.exe` (no `Activate.ps1` needed); see
[Starting on a managed Windows PC](https://github.com/evdanil/cn-tool/blob/main/docs/windows.md#starting-on-a-managed-windows-pc).

## Command line

```console
$ cn ping 127.0.0.1 --tcp 22,443
PING
            ╷           ╷        ╷        ╷
  Host      │ Address   │ Result │ TCP 22 │ TCP 443
╶───────────┼───────────┼────────┼────────┼─────────╴
  127.0.0.1 │ 127.0.0.1 │ OK     │ closed │ closed
            ╵           ╵        ╵        ╵
```

```console
cn ip 192.0.2.5 --format json            # one address: subnet, DNS name, status
cn subnet 192.0.2.0/24 --available       # a subnet, and its addresses with no record
cn monitor 192.0.2.0/28 --every 1m --for 2h
cn diff router01 --since 24h             # configuration changes of a device
```

Results go to stdout, progress and errors to stderr, and a command never prompts without a
terminal. `cn` alone opens the menu; `cn --help` lists the commands.

<a id="included-features"></a>

## Features

- **Infoblox lookups:** IPv4 and IPv6 addresses, subnets, DNS names and sites, with network
  views, DHCP data and extensible attributes.
- **Ping and Monitor:** ICMP and TCP checks of hosts and subnets, repeated rounds with a
  stored history, and a map of every address in the browser.
- **Unused addresses:** the addresses of a subnet with no Infoblox record, and the monitored
  addresses that never replied.
- **Device configurations:** search a local repository, list what changed (`cn diff`) and
  compare snapshots in a terminal browser.
- **Output:** table, JSON, Markdown or CSV on the command line; an Excel report, with
  optional email delivery.
- **Optional integrations:** Active Directory subnets, SD-WAN YAML search and device
  inventory over SSH.

## Requirements

- Python 3.10 or newer (tested on 3.10, 3.12, 3.13 and 3.14).
- Linux, macOS, or Windows 10 and 11 (x64).
- For Infoblox lookups: a WAPI URL and an account that may use the API and read the data.
- For ICMP: the `ping` command of the system. For the browser interface: a current browser.

<a id="notes"></a>
cn-tool reads from Infoblox and never changes it. Reports can hold sensitive network data and keep earlier results, so
review one before you share it. A list of unused addresses is a lead to check, not proof
that an address is free.

## Documentation

This README and the guides describe the current source, 0.15.1; check `cn --version` and
choose the matching tag for an installed release. The menu and the command line are as in
0.8.4; release **0.9.0** added the browser tools beyond Subnets, and 0.10.0 the unused
address lists. The [documentation index](https://github.com/evdanil/cn-tool/blob/main/docs/README.md)
and the [WebUI guide](https://github.com/evdanil/cn-tool/blob/main/docs/webui.md#version-scope)
give the version scope in full.

| Guide | Covers |
| --- | --- |
| <a id="from-the-zip-or-a-clone"></a>[Installation](https://github.com/evdanil/cn-tool/blob/main/docs/installation.md) | pipx, virtual environments, release archives, upgrades, first run |
| [Install with your own Python](https://github.com/evdanil/cn-tool/blob/main/docs/install-own-python.md) | A Python in `/opt` with a virtual environment in your home |
| <a id="windows"></a><a id="terminal-and-python"></a><a id="passwords-in-powershell"></a><a id="scheduled-tasks"></a><a id="output-and-encoding"></a><a id="files-reports-and-certificates"></a><a id="what-differs-from-linux"></a>[Windows](https://github.com/evdanil/cn-tool/blob/main/docs/windows.md) | PowerShell, managed PCs and the **cn-tool Web** shortcut, scheduled tasks |
| [Browser interface](https://github.com/evdanil/cn-tool/blob/main/docs/webui.md) | Every page, keyboard shortcuts, reports, Stop and Quit |
| <a id="output"></a><a id="exit-status"></a><a id="json-for-scripts"></a><a id="health-check-cn-doctor"></a>[Command line](https://github.com/evdanil/cn-tool/blob/main/docs/cli.md) | Commands, input files, output formats, exit statuses, `cn doctor` |
| <a id="ptr-dhcp-utilization-and-child-containers"></a><a id="network-views"></a><a id="ipv6"></a>[Infoblox](https://github.com/evdanil/cn-tool/blob/main/docs/infoblox.md#access-and-setup) | Access and setup, network views, IPv6, unused addresses |
| <a id="bulk-ping-cn-ping"></a><a id="ping-monitor-cn-monitor"></a>[Ping and monitoring](https://github.com/evdanil/cn-tool/blob/main/docs/ping-monitor.md) | Probe limits, history, reruns and deletion |
| <a id="configuration"></a>[Configuration](https://github.com/evdanil/cn-tool/blob/main/docs/configuration.md) | File precedence, every setting, reports |
| <a id="credentials"></a><a id="gpg-credentials-file"></a><a id="gpg-credentials-file-1"></a><a id="infoblox-account-file"></a>[Credentials](https://github.com/evdanil/cn-tool/blob/main/docs/credentials.md) | Infoblox and device accounts, environment variables, GPG files |
| <a id="optional-integrations"></a><a id="active-directory"></a><a id="email"></a><a id="sd-wan-yaml-search"></a>[Integrations](https://github.com/evdanil/cn-tool/blob/main/docs/integrations.md) | Active Directory, email, SD-WAN YAML, device inventory |
| <a id="config-analyzer"></a><a id="configuration-changes-cn-diff"></a>[Configuration history](https://github.com/evdanil/cn-tool/blob/main/docs/config-analyzer.md) | `cn diff`, repository layout, the terminal browser |
| <a id="whats-new-in-081"></a><a id="whats-new-in-080"></a><a id="whats-new-in-070"></a>[Release notes](https://github.com/evdanil/cn-tool/blob/main/docs/release-notes.md) | Changes and upgrade notes for each release |

[Releases](https://github.com/evdanil/cn-tool/releases) ·
[Issues](https://github.com/evdanil/cn-tool/issues) ·
[PyPI](https://pypi.org/project/cn-tool/) ·
[Apache-2.0 license](https://github.com/evdanil/cn-tool/blob/main/LICENSE)
