ZpServer

static class · namespace z3n7 · source Server/ZpServer.cs

public static class ZpServer

HTTP server inside ZennoPoster that takes commands from an orchestrator directly, without the database. Start: project.StartZpServer(); stop: project.StopZpServer(). Endpoints: GET /state (tasks and processes of this machine), POST /command ({ action, task_id, payload }, executed immediately), GET/POST /task/xml, GET /task/settings, GET /log (ZennoPoster log files), GET /traffic (JSONL traffic: tail=N or pages by byte offset), GET /traffic/har, GET /version (z3n7, ZennoPoster and runtime versions), GET /debug/assemblies. Every route requires the token: header Authorization: Bearer {token} or parameter ?token= (for download links). See ZpAuth.

Methods

StartZpServer

public static void StartZpServer(this IZennoPosterProjectModel project, int port = 22222, bool log = false, bool openFirewall = false)

Extension method for IZennoPosterProjectModel. source

Loads the access token, takes the first free port from port (up to 20 tried) and starts serving on a background thread. When the server is already running, only prints the node line again. A taken port is not an error; a missing URL ACL (access denied) stops the attempt with a warning that names the netsh http add urlacl command.

Parameter Description
port First port to try.
log Print the node registration line (and its hints) to the log.
openFirewall Create an inbound firewall rule for the port when none is found (needs administrator rights).

StopZpServer

public static void StopZpServer(this IZennoPosterProjectModel project, bool log = false)

Extension method for IZennoPosterProjectModel. source

Stops the server.

Parameter Description
log Write a line to the log.