Skip to main content

PS net

Register connections and count established connections.

dynamic_loader("nauthilus_psnet")
local nauthilus_psnet = require("nauthilus_psnet")

nauthilus_psnet.register_connection_target

Registers a target for which Nauthilus will count established connections.

Syntax

nauthilus_psnet.register_connection_target(target, direction, description)

Parameters

  • target (string): Hostname:port or IP-address:port tuple
  • direction (string): Connection direction
    • remote: The target is outside of Nauthilus
    • local: The target is local to Nauthilus
  • description (string): A description about this target

Returns

None

Example

dynamic_loader("nauthilus_psnet")
local nauthilus_psnet = require("nauthilus_psnet")

local target = "api.pwnedpasswords.com:443"
local direction = "remote"
local description = "Some meaningful description"

nauthilus_psnet.register_connection_target(target, direction, description)
tip

You can register targets in an init Lua script

nauthilus_psnet.get_connection_target

Gets the current number of established connections for a target.

Syntax

local count, err = nauthilus_psnet.get_connections_target(target)

Parameters

  • target (string): Hostname:port or IP-address:port tuple

Returns

  • count (number): The number of established connections
  • err (string): An error message if the operation fails

Example

dynamic_loader("nauthilus_psnet")
local nauthilus_psnet = require("nauthilus_psnet")

local target = "api.pwnedpasswords.com:443"

local count, err = nauthilus_psnet.get_connections_target(target)
if err then
print("Error:", err)
else
print("Current connections:", count)
end