Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

GNU Netcat

$ nc Foundation Med Risk
GNU · Browser & Web · GPL-2.0 · macos / linux

GNU Netcat (nc) reads and writes raw data across TCP and UDP connections (nc -vz host 443, nc -l -p 8080). Useful for fast port reachability checks with -z -w, though unencrypted transport and subtle flag differences between GNU Netcat, OpenBSD nc, and Nmap ncat require care.

FCRS-1.0 Score
67 /100
Usable w/ Caveats
High Confidence
Zero-Friction Install
brew install netcat
CLI vs MCP Decision CLI Only

Performs raw local/LAN TCP/UDP port probing and socket piping (nc -vz); MCP tools cannot open raw network sockets.

Agent-Readiness Checklist

Local Probe Evidence
— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md
Version
nc: unrecognized option `--version'
Startup
4 ms
Exit Codes (help / invalid)
1 / 1
NO_COLOR Clean / Non-TTY Safe
Yes / Safe
Captured --help excerpt
nc: unrecognized option `--help'
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port]
	  [--apple-recv-anyif] [--apple-awdl-unres]
	  [--apple-boundif ifbound]
	  [--apple-no-cellular] [--apple-no-expensive]
	  [--apple-no-flowadv] [--apple-tcp-timeout conntimo]
	  [--apple-tcp-keepalive keepidle] [--apple-tcp-keepintvl keepintvl]
	  [--apple-tcp-keepcnt keepcnt] [--apple-tclass tclass]
	  [--tcp-adp-rtimo num_probes] [--apple-intcoproc-allow]
	  [--apple-tcp-adp-wtimo num_probes]
	  [--setsockopt-later] [--apple-no-connectx]
	  [--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
	  [--apple-kao] [--apple-ext-bk-idle]
	  [--apple-netsvctype svc] [---apple-nowakefromsleep]
	  [--apple-notify-ack] [--apple-sockev]
	  [--apple-tos tos] [--apple-tos-cmsg]
	  [--apple-tcp-maxseg mss]
	  [-s source_ip_address] [-w timeout] [-X proxy_version]
	  [-x proxy_address[:port]] [hostname] [port[s]]

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 15 / 25

Zero-I/O -z returns clean exit codes with -w timeouts, but stderr text is unstructured and nc flag syntax varies wildly across GNU, BSD, and ncat.

  • nc -vz -w 2 gives reliable boolean port exit status
  • Flag incompatibility across GNU vs OpenBSD nc builds
Trust & Safety 16 / 25

Plaintext-only TCP/UDP without TLS; GNU Netcat also supports dangerous -e/-c program execution flags and arbitrary listener binding.

  • Unencrypted sockets; supports -e/-c execution flags
Setup & Portability 12 / 15

Pre-installed /usr/bin/nc on macOS/Linux is usually OpenBSD nc rather than GNU Netcat (brew install netcat), causing flag surprises (-p with -l).

  • Requires brew install netcat on macOS if GNU flags are expected
Utility & Efficiency 11 / 15

Handy minimal TCP/UDP reachability check, though socat, curl, and websocat handle TLS and structured protocols much better.

  • Minimal raw socket probing without TLS
Maintenance & Lineage 6 / 10

Legacy GNU Netcat upstream (0.7.1) is largely dormant compared to OpenBSD nc or Nmap ncat.

  • Dormant upstream SourceForge releases since 0.7.1
Docs & Verifiability 7 / 10

Basic nc --help and GNU Netcat man/info pages.

  • nc --help and netcat.sourceforge.net docs

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No authentication credentials or TLS certificates supported; all socket traffic is plaintext.

Side Effects
Read-Only Local Write Remote Write
Cost & Quotas

Free, GPL-2.0 open-source GNU utility.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# GNU Netcat (nc) Agent Rules
- Always pass `-w <seconds>` so `nc` cannot hang indefinitely on unresponsive hosts.
- Never use `-e` / `-c` command execution flags or bind `-l` on public interfaces; check `nc -h` first because macOS/Linux often ship incompatible `nc` variants.

Agent-Ready Command Recipes

Safe Read-Only Queries

Check if a local TCP port is listening
nc -vz -w 2 127.0.0.1 8080

Performs a zero-I/O connect check (-z) with a 2-second timeout (-w 2) on 127.0.0.1:8080.

Controlled Writes & Previews

Pipe a single HTTP probe over raw TCP
printf 'HEAD / HTTP/1.0\r\nHost: localhost\r\n\r\n' | nc -w 2 127.0.0.1 8080

Sends a raw HTTP HEAD request to 127.0.0.1:8080 and closes after a 2-second idle timeout.

Strengths for Agents

  • + Fast, lightweight boolean TCP port check via nc -vz -w <secs> <host> <port>.
  • + Simple stdin/stdout piping for quick raw protocol debugging.

Caveats & Pitfalls

  • ! Incompatible -l/-p/-q flags between GNU Netcat, macOS BSD nc, and Linux netcat-openbsd.
  • ! Dormant upstream maintenance and no native TLS encryption.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI