shellgraph

Command line

The subcommands, flags, configuration file and environment variables of shellgraph.

shellgraph login

Tests a collector token and keeps it in the configuration file.

shellgraph login --server https://shellgraph.example.net --token <token>
FlagDefaultDescription
--server(required)Server URL.
--tokenSHELLGRAPH_TOKENCollector token. Create it in the server UI.
--insecure-httpoffAccept an http:// URL that is not localhost or 127.0.0.1.

All users of the machine can see the flags of a command in the process list. On a machine with other users, give the token in the variable SHELLGRAPH_TOKEN and do not use --token:

read -rs SHELLGRAPH_TOKEN && export SHELLGRAPH_TOKEN
shellgraph login --server https://shellgraph.example.net

shellgraph scan

Scans one VLAN and sends one report.

shellgraph scan --env Production --vlan app-10
FlagDefaultDescription
--envmenuEnvironment name or ID. Without it, the collector shows a menu.
--vlanmenuVLAN name or ID. Without it, the collector shows a menu.
--concurrency32Number of hosts to scan at the same time. If a firewall blocks the collector, use a lower value. See Scan a large VLAN.
--samples3Number of socket samples on each host. More samples find more short connections.
--interval5sTime between two samples.
--dry-runoffPrint the report as JSON and do not send it.
--allow-largeoffAllow a VLAN with more than 4096 addresses.
--insecure-httpoffAccept an http:// server URL that is not localhost or 127.0.0.1.
--tcp-timeout1.5sTime to wait for an answer on the SSH port. For a slow network (VPN, WAN), use a higher value.
--verboseoffAlso show a line for each address with the status no_ssh, with the reason.

A scan of a /24 VLAN with the default flags takes approximately 15 to 30 seconds. If you stop the scan (Ctrl-C), the collector sends nothing.

If the send fails because of a network error, a timeout, or an answer 408, 429 or 5xx, the collector tries again after 10 seconds and after 30 seconds. If the third attempt fails, or if the server rejects the report, the collector keeps the report as a pending report (see Configuration). Send it later with shellgraph send.

The server replaces the host data with each report, so an old report makes the map go back. When a scan sends its report, the collector deletes the pending reports of the same VLAN.

shellgraph send

Sends the pending reports, from the oldest to the newest. The collector deletes each report that the server accepts.

shellgraph send
shellgraph send ~/.config/shellgraph/pending/vlan-3-20261019T120000Z.json.gz

Without a file, the collector sends all the pending reports. It tries each report 3 times, as scan does.

FlagDefaultDescription
--insecure-httpoffAccept an http:// server URL that is not localhost or 127.0.0.1.

shellgraph probe

Collects one host and prints it as JSON. It does not use the server.

shellgraph probe -i ~/.ssh/id_ed25519 shellgraph@10.0.10.12
FlagDefaultDescription
-issh-agentPrivate key file. A key with a passphrase must be in the ssh-agent.
-p22SSH port.
-samples1Number of socket samples.
-interval5sTime between two samples.
-no-sudooffDo not use sudo for ss.
-rawoffPrint the raw output of the collection script, not the result.

shellgraph version

Prints the version.

Configuration

shellgraph login writes the server URL and the token to a file with mode 0600:

SystemFile
Linux~/.config/shellgraph/config.json
macOS~/Library/Application Support/shellgraph/config.json
Container image/home/shellgraph/.config/shellgraph/config.json

The pending reports are in the pending directory next to the configuration file, with mode 0600. Each file is vlan-<VLAN ID>-<scan start time>.json.gz: the report as gzip JSON. In the container image, mount a volume on /home/shellgraph/.config/shellgraph to keep them.

Environment variables

VariableDescription
SHELLGRAPH_SERVERServer URL. It overrides the configuration file.
SHELLGRAPH_TOKENCollector token. It overrides the configuration file. shellgraph login uses it when --token is not set.