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>
| Flag | Default | Description |
|---|---|---|
--server | (required) | Server URL. |
--token | SHELLGRAPH_TOKEN | Collector token. Create it in the server UI. |
--insecure-http | off | Accept 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
| Flag | Default | Description |
|---|---|---|
--env | menu | Environment name or ID. Without it, the collector shows a menu. |
--vlan | menu | VLAN name or ID. Without it, the collector shows a menu. |
--concurrency | 32 | Number of hosts to scan at the same time. If a firewall blocks the collector, use a lower value. See Scan a large VLAN. |
--samples | 3 | Number of socket samples on each host. More samples find more short connections. |
--interval | 5s | Time between two samples. |
--dry-run | off | Print the report as JSON and do not send it. |
--allow-large | off | Allow a VLAN with more than 4096 addresses. |
--insecure-http | off | Accept an http:// server URL that is not localhost or 127.0.0.1. |
--tcp-timeout | 1.5s | Time to wait for an answer on the SSH port. For a slow network (VPN, WAN), use a higher value. |
--verbose | off | Also 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.
| Flag | Default | Description |
|---|---|---|
--insecure-http | off | Accept 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
| Flag | Default | Description |
|---|---|---|
-i | ssh-agent | Private key file. A key with a passphrase must be in the ssh-agent. |
-p | 22 | SSH port. |
-samples | 1 | Number of socket samples. |
-interval | 5s | Time between two samples. |
-no-sudo | off | Do not use sudo for ss. |
-raw | off | Print 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:
| System | File |
|---|---|
| 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
| Variable | Description |
|---|---|
SHELLGRAPH_SERVER | Server URL. It overrides the configuration file. |
SHELLGRAPH_TOKEN | Collector token. It overrides the configuration file. shellgraph login uses it when --token is not set. |