The following commands can be executed while attached to the daemon via pkctl attach.

beacon

Creates a DNS beacon that this host will respond to as if it were a legitimate DNS server. If a beacon already exists at this hostname, record type, and record class, it will be overwritten.

Arguments: DNS data (hex string), hostname (string), record type (string), record class (string, optional).

DNS data must be a string representing the hex-encoded binary data to be returned as the answer to a DNS query for this record.

Hostname is the DNS hostname for which to answer queries.

Record type must be one of A, AAAA, CNAME, MX, or TXT. Data must be formatted correctly per record type or else malformed responses will be returned.

Record class must be one of IN, CH, or HS, or else omitted. Defaults to IN (the internet).

Usage:

pk> beacon 01020304 x.z.pkctl.org A IN

delbeacon

Deletes one or more beacons according to arguments supplied. If only hostname is supplied, all beacons matching hostname will be deleted. If more arguments are supplied, the search will be narrowed accordingly.

Arguments: hostname (string), record type (string, optional), record class (string, optional).

See beacon reference for the meanings of these arguments.

Usage:

pk> delbeacon x.z.pkctl.org A IN

nbeacons

Prints the number of currently active DNS beacons.

Usage:

pk> nbeacons
[pk] Active beacons: 224

lbeacons

Lists all currently active DNS beacons and their data.

Usage:

pk> lbeacons
[pk] Active beacons:
- x.z.pkctl.org A IN: 01020304
- ...
[pk] 224 total.

nscreen

Prints the number of currently attached controller screens.

Usage:

pk> nscreen
[pk] Active screens: 2

ncli

Prints the number of currently connected TCP clients.

Usage:

$ ncli
[pk] Active TCP clients: 27

lcli

Lists the currently connected TCP clients and their descriptive information.

$ lcli
[pk] Active TCP clients:
- 0: {'ip': '127.0.0.1', 'rport': 47874, 'rdns': 'localhost'}
- ...
[pk] 27 total.

lq

Lists the queue of commands to be executed by newly connected clients.

Usage:

pk> lq
['whoami', 'hostname']

cq

Clears the command queue.

Usage:

pk> cq

show-serverkey

Prints the server's public key in a format easily copyable into an HDB entry.

Usage:

pk> show-serverkey
{"n": ..., "e": ...}

pty

Connects your screen to the specified client in a one-on-one terminal session, similar to SSHing into the client machine.

Arguments: client ID (integer) — can be found with lcli.

Usage:

$ pty 3

refresh-hdb

Commands the client to refresh its internal hosts database from the web resource it was originally pulled from.

Usage:

$ refresh-hdb

tunnel

Commands the client to disconnect and sleep for the number of seconds configured in TTS.

Usage:

$ tunnel

die

Commands the client to exit and not respawn.

Usage:

$ die

Shell Commands

Inputs which are not recognized as server commands will be interpreted as shell commands, which will be blasted to all connected clients and queued for future clients to receive as well. Once executed, the results of these commands will be blasted to all active screens, and logged in case no screen is watching at the time of the response. The active command queue can be managed by way of the lq and cq commands.

Targeting

In the event that you would prefer not to dispatch a command to all current and future clients, a specific set of targets can be specified by prepending TARGET={targets} to the command, where {targets} is a comma-delimited list of client IDs (integers). These client IDs can be retrieved by checking the output of lcli. Commands which are targeted are not queued for future clients to receive.

Usage:

$ TARGET=0,4,57,264 echo hello