Skip to content

Add standalone --directory UDS corporate-directory harvest - #26

Merged
bandrel merged 10 commits into
mainfrom
feat/uds-directory-flag
Jun 12, 2026
Merged

Add standalone --directory UDS corporate-directory harvest#26
bandrel merged 10 commits into
mainfrom
feat/uds-directory-flag

Conversation

@bandrel

@bandrel bandrel commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a standalone --directory flag that harvests the unauthenticated CUCM UDS corporate directory (/cucm-uds/users) — usernames, extensions (phoneNumber), and contact fields (email, department, title, home/mobile numbers) — without the device probing, config downloads, or password spraying that --userenum performs.
  • Output is always visible: writes cucm_directory.csv by default (override with --directory-outfile), prints a console summary table, and persists to the uds_directory table unless --no-db.
  • Fixes the "no directory is created" bug: --userenum now always writes its companion directory CSV instead of silently requiring --csv. --directory-outfile is honored on both paths.
  • Reuses existing harvest/persist/export functions; adds a small print_directory_table helper. README documents the flag, including an honest note that the unauthenticated UDS directory exposes no dedicated DID field (phoneNumber is the extension/DN, which in some dial plans is the full DID; true external DIDs require authenticated AXL).

Test Plan

  • uv run pytest -q — 242 passed, 2 skipped
  • New mocked CLI tests: --directory requires -H; writes CSV + table without --csv; --no-db still writes CSV + persists check; --userenum writes directory without --csv; --userenum honors --directory-outfile
  • New unit tests for print_directory_table (rows + display-name fallback + empty-list safety)
  • Manual verification against a live CUCM (UDS directory harvest) — recommended before merge

🤖 Generated with Claude Code

bandrel and others added 10 commits June 12, 2026 11:30
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds --directory and --directory-outfile CLI args that harvest the
unauthenticated CUCM UDS corporate directory, always printing a console
table and writing a CSV, then exiting. Requires -H/--host.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove developer-local cwd= from all three subprocess.run calls so tests
run on any machine. Add sqlite3 assertion to confirm uds_directory table
is populated when --db is passed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wires args.directory_outfile into the --userenum directory export so the
README's documented override is real, hoists the sqlite3 import, and adds a
regression test for the --userenum --directory-outfile path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The harvest and uds_directory table already capture middleName, but
_DIRECTORY_CSV_COLUMNS and the --show-db companion SELECTs dropped it,
silently losing the field on export. Add middle_name in all three aligned
spots (column tuple + both SELECTs) so live --directory and DB-sourced
exports stay in sync.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The /cucm-uds/users response exposes 17 fields; the harvest previously
dropped nickName, directoryUri, and pager. Add all three across the field
map, CSV columns, table schema, INSERT/upsert, and the --show-db SELECTs
(kept in a single canonical column order). Existing thief.db files are
migrated with ALTER TABLE ADD COLUMN since CREATE TABLE IF NOT EXISTS does
not add columns to an already-created table. directoryUri is the notable
add — it is the user's SIP/email-style directory address.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Removes the --uds-devices / --uds-user / --uds-password feature and its
backing functions (get_user_devices_authenticated,
enumerate_devices_authenticated, parse_uds_device_collection). This was the
only path that authenticated to UDS with end-user credentials to sweep
per-user /cucm-uds/user/{id}[/devices] records.

The unauthenticated device probe (get_user_devices_unauthenticated,
enumerate_devices_unauthenticated, used by --userenum), the uds_devices
table, parse_uds_devices, and download_uds_discovered_configs are all kept.
Drops the dedicated CLI test file and the authenticated-path unit tests;
updates README and --uds-port help text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bandrel
bandrel merged commit 8b4f427 into main Jun 12, 2026
2 checks passed
@bandrel
bandrel deleted the feat/uds-directory-flag branch June 12, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant