8. Console¶
The console allows to execute and interact with a running haka daemon. It is possible to get some statistics or to drop a connection for instance.
8.1. Starting the console¶
The console is started using hakactl console. On connection, a prompt allows to write Lua commands. The completion is also available to guide the user and list the available functions.
This section provides the list of all available commands.
8.2. Returned data¶
Most functions return an object containing all requested data. This object named List have many features to enable advanced scripting.
- object List¶
Collection of elements.
- <List>[field] → value¶
Parameters: - field (string) – Field to retrieve.
Returns: - value – Value for the field.
Get a field value for the given field.
- <List>:get(key) → list¶
Parameters: - key – Key to retrieve.
Returns: - list (List) – New list containing only the requested element.
Select only one element from a list.
This object is used by various console commands. Each of them will list the available fields as well as the extra method available when it is the case.
8.3. General utilities¶
- threads() → list¶
Returns: - list (List) – Threads information.
Get information about the haka threads (id, packet statistics, byte statistics...).
- rules() → list¶
Returns: - list (List) – Rules information.
Get information about the loaded rules (name, event...).
- events() → list¶
Returns: - list (List) – Events information.
Get information about all events registered in haka.
- setloglevel(level[, module])¶
Parameters: - level (string) – Log level ('debug', 'info', 'warning', 'error' or 'fatal').
- module (string) – Module name if needed.
Change the logging level of haka.
- stop()¶
Cleanly stop the running haka.
8.4. Protocol utilities¶
8.4.1. UDP¶
- udp.connections(show_dropped=false) → list¶
Parameters: - show_dropped (boolean) – true if also the dropped connections should be listed.
Returns: - list (UdpConnList) – Udp connections information.
Get information about all udp connections currently known in haka (ips, ports, statistics, state...).
Some extra method are available on this list:
8.4.2. TCP¶
- tcp.connections(show_dropped=false) → list¶
Parameters: - show_dropped (boolean) – true if also the dropped connections should be listed.
Returns: - list (TcpConnList) – Tdp connections information.
Get information about all tcp connections currently known in haka (ips, ports, statistics, state...).
Some extra method are available on this list: