Fix #1385: derive nxcdb hosts CSV header from the protocol's HostsTable - #1387
Fix #1385: derive nxcdb hosts CSV header from the protocol's HostsTable#1387Diogo-Damasceno wants to merge 1 commit into
Conversation
|
Hi and thanks for the PR! Please revert the formatting changes tho. Also please disclose AI usage in the PR description (see PR template). |
…s HostsTable The `export hosts` CSV header was hard-coded to the SMB schema (smbv1/signing/spooler/zerologon/petitpotam), so exporting hosts for any other protocol (RDP, MSSQL, SSH, LDAP, ...) produced a header that did not match the row content. Now the header is derived from the active protocol's HostsTable columns via a new `host_csv_headers()` helper, as suggested in the issue: default to the real column names instead of static SMB strings. `simple` keeps the first 8 columns (historical row width); `detailed` returns every column of the table. No unrelated formatting changes. Added tests/test_nxcdb_host_export.py covering SMB (no regression) and RDP (no SMB-only columns leak into the header). Verified on Python 3.14.7.
26c55d1 to
ce33ac0
Compare
|
Thanks @NeffIsBack — and sorry about the formatting noise, that was on me. I let the formatter loose on lines that had nothing to do with the fix. I've reverted all of it now: the diff is just the I also added the AI-usage disclosure to the description as you asked. For the record: I put this together with the help of the DeepHat agent and the Hermes Agent, which I used strictly as tools — I drove every step myself, reviewed the diff line by line, wrote and ran the regression tests, and confirmed the SMB simple/detailed shape is unchanged. Logic and tests are unchanged; SMB exports still produce the same simple/detailed shape as before. Let me know if anything else needs a look. |
Description
Fixes #1385. The
export hostsCSV header was hard-coded to the SMB schema (smbv1/signing/spooler/zerologon/petitpotam), so exporting hosts for any other protocol (RDP, MSSQL, SSH, LDAP, ...) produced a header that did not match the row content.Change: the header is now derived from the active protocol'
HostsTablecolumns via a newhost_csv_headers()helper, as suggested in the issue (default to the real column names instead of static SMB strings).simplekeeps the first 8 columns (historical row width);detailedreturns every column of the table. I kept the diff to just this logic — no autoformatter noise on unrelated lines.AI usage disclosure: I put this together with the help of the DeepHat agent and the Hermes Agent, which I used strictly as tools. I drove every step myself: identified the root cause, reviewed the diff line by line, wrote and ran the regression tests, and confirmed the SMB simple/detailed output shape is unchanged (no regression). The logic and the tests are mine; the agents were just a faster keyboard.
Type of change
Setup guide for the review
nxc rdp <host>thennxcdb,proto rdp,export hosts detailed rdp.csv.id;ip;hostname;domain;os;dc;smbv1;signing;spooler;zerologon;petitpotam(SMB-only, wrong for RDP).id;ip;hostname;domain;os;nla-- matches the actual RDP row content.pytest tests/test_nxcdb_host_export.py(3 tests: SMB simple/detailed unchanged, RDP has no SMB-only columns). Note: I could not run the full NetExec suite locally becauseaardwolfdoes not build on Python 3.14 (see Install fails with Python 3.14 #1241); the change is isolated to the CSV header derivation and is covered by the new unit tests.Checklist