5. Host User Scripts

The Host User Scripts API is only available from the Host User Scripts Hooks.

Functions

function getIp()

Get the Host IP address and VLAN information.

Return
table:

ip: the host IP address

vlan: the host VLAN ID (0 for no VLAN)

function isLocal()

Check if the host is local.

Return
true if local, false otherwise

function getApplicationBytes(int app_id)

Get the nDPI application bytes.

Return
the nDPI application bytes
Parameters
  • app_id: the nDPI application ID

function getBytes()

Get the bytes sent and received by the host.

Return
table:

bytes.sent: the bytes sent

bytes.rcvd: the bytes received

function getPackets()

Get the packets sent and received by the host.

Return
table:

packets.sent: the packets sent

packets.rcvd: the packets received

function getNumFlows()

Get the total flows of the host.

Return
table:

total_flows.as_client: the number of flows generated by the host

total_flows.as_server: the number of flows received by the host

function getTime()

Get time information about the host.

Return
table:

seen.first: the Unix timestamp when the host was first seen seen.last: the Unix timestamp when the host was last seen duration: the total seconds the host was seen total_activity_time: the total seconds in which the host was active

function getDNSInfo()

Get detailed DNS information on the host.

Return
a lua table with the information. See DnsStats::lua for details

function getHTTPInfo()

Get detailed HTTP information on the host.

Return
a lua table with the information. See HTTPstats::lua for details

function getTsKey()

Get the unique key to be used to store host timeseries data.

Return
the host timeseries key