### Install livebox CLI using Go Source: https://github.com/maelvls/livebox/blob/main/README.md Installs the livebox CLI tool using the Go package manager. Requires Go version 1.21 or later. This command fetches the latest version of the 'livebox' package from the specified GitHub repository. ```bash go install github.com/maelvls/livebox@latest ``` -------------------------------- ### Manage Livebox Wi-Fi Configuration Source: https://context7.com/maelvls/livebox/llms.txt This section covers the management of Wi-Fi settings for both 2.4GHz and 5GHz bands on a Livebox. CLI commands are provided to configure both bands simultaneously or individually, enable/disable Wi-Fi globally or for specific bands. The Go code example shows how to set detailed Wi-Fi parameters, including SSID, security mode, and passphrase, for multiple wireless access points (WLAN VAPs) representing different bands. ```bash # Configure both bands with same settings livebox wifi config --ssid "MyNetwork" --pass "mypassword" # Configure specific band livebox wifi config --24ghz --ssid "MyNetwork_2G" --pass "mypassword" livebox wifi config --5ghz --ssid "MyNetwork_5G" --pass "mypassword" # Configure both bands explicitly livebox wifi config --ssid "MyNetwork" --pass "mypassword" --24ghz --5ghz # Enable/disable Wi-Fi livebox wifi enable livebox wifi disable # Enable/disable specific band livebox wifi enable --5ghz livebox wifi disable --24ghz ``` ```go // Configure Wi-Fi settings wlanvap := map[string]any{ "wl0": map[string]any{ // 2.4GHz "SSID": "MyNetwork", "SSIDAdvertisementEnabled": true, "Security": map[string]any{ "ModeEnabled": "WP2-Personal", "KeyPassPhrase": "mypassword", }, "MACFiltering": map[string]any{"Mode": "Off"}, "WPS": map[string]any{"Enable": false}, }, "eth4": map[string]any{ // 5GHz "SSID": "MyNetwork_5G", "SSIDAdvertisementEnabled": true, "Security": map[string]any{ "ModeEnabled": "WP2-Personal", "KeyPassPhrase": "mypassword", }, "MACFiltering": map[string]any{"Mode": "Off"}, "WPS": map[string]any{"Enable": false}, }, } params := map[string]any{"mibs": map[string]any{"wlanvap": wlanvap}} _, err := executeRequest(address, contextID, cookie, "NeMo.Intf.lan", "setWLANConfig", params) ``` -------------------------------- ### Manage Livebox Static DHCP Leases Source: https://context7.com/maelvls/livebox/llms.txt This section details how to manage static DHCP leases for devices on the Livebox network. It provides CLI commands to list, set, and remove static leases, associating MAC addresses with specific IP addresses. The Go code example demonstrates adding a static lease programmatically and includes error handling for cases where the IP address is already reserved. ```bash # List static leases livebox static-lease ls # Create static lease livebox static-lease set bc:d0:74:32:e9:1a 192.168.1.155 # Remove static lease livebox static-lease rm bc:d0:74:32:e9:1a ``` ```go // Add static lease params := map[string]any{ "MACAddress": "bc:d0:74:32:e9:1a", "IPAddress": "192.168.1.155", } _, err := executeRequest(address, contextID, cookie, "DHCPv4.Server.Pool.default", "addStaticLease", params) // Handle API error 393221 (IP already reserved) var apiErrs APIErrors if errors.As(err, &apiErrs) { for _, apiErr := range apiErrs { if apiErr.ErrorCode == 393221 { return fmt.Errorf("IP address already reserved") } } } ``` -------------------------------- ### Manage Livebox DNS Names for Devices Source: https://context7.com/maelvls/livebox/llms.txt This snippet explains how to assign custom DNS names to devices on the local network via the Livebox. It includes CLI commands to list devices with their assigned DNS names and to set a new DNS name for a specific device using its MAC address. The Go code example demonstrates programmatically setting a device's DNS name by providing its MAC address and the desired name. ```bash # List devices with DNS names livebox dns ls # Set DNS name for device livebox dns set D8:10:68:8A:E9:C4 my-custom-name # Output displays table of IP, MAC, and DNS names ``` ```go // Set device DNS name mac := strings.ToLower("D8:10:68:8A:E9:C4") _, err := executeRequest(address, contextID, cookie, "Devices.Device." + mac, "setName", map[string]any{ "name": "my-custom-name", "source": "dns", }) ``` -------------------------------- ### Execute Raw API Calls on Livebox Source: https://context7.com/maelvls/livebox/llms.txt This section demonstrates how to interact directly with the Livebox API using raw JSON requests via the CLI. Examples show how to execute arbitrary API calls by piping JSON payloads to the `livebox api` command, including retrieving network interface configurations and fetching phone call logs. This method is useful for accessing functionalities not directly exposed by the standard CLI commands. ```bash # Execute raw API request livebox api <<<'{"service":"NeMo.Intf.lan","method":"getMIBs","parameters":{"mibs":"base wlanradio"}}' # Get phone call list livebox api <<<'{"service":"VoiceService.VoiceApplication","method":"getCallList","parameters":{"line":"1"}}' ``` -------------------------------- ### Get DSL Speed Programmatically Source: https://context7.com/maelvls/livebox/llms.txt Retrieves DSL connection speed information programmatically by querying specific Management Information Bases (MIBs) via an API request. The results for downstream and upstream rates need to be parsed from the response and converted from Kbps to Mbps. ```go // Get DSL speed information response, err := executeRequest(address, contextID, cookie, "NeMo.Intf.data", "getMIBs", map[string]any{"mibs": "dsl"}) // Parse result.status.dsl.dsl0.DownstreamCurrRate and UpstreamCurrRate // Convert from Kbps: rate * 0.96 / 1000 = Mbps ``` -------------------------------- ### Remove and get DMZ configuration with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Removes the current DMZ configuration from the Livebox router or retrieves the IP address of the currently DMZ'ed device. These commands are useful for managing and verifying the DMZ settings. ```bash livebox dmz rm ``` ```bash livebox dmz get ``` -------------------------------- ### Set Livebox IPv6 Pinhole Programmatically (Go) Source: https://context7.com/maelvls/livebox/llms.txt Demonstrates how to set an IPv6 pinhole rule programmatically using Go. It defines a map of parameters including destination IP, port, protocol (TCP/UDP), and version (IPv6), then executes the 'setPinhole' API call. A subsequent 'commit' call is necessary to apply the changes. ```go // Set IPv6 pinhole programmatically params := map[string]any{ "id": "mypinhole", "origin": "webui", "sourceInterface": "data", "destinationPort": "41642", "destinationIPAddress": "192.168.1.160", "destinationMACAddress": "e4:5f:01:a6:65:fe", "protocol": "6", // 6=TCP, 17=UDP "ipversion": 6, "enable": true, "persistent": true, } _, err := executeRequest(address, contextID, cookie, "Firewall", "setPinhole", params) // Must call commit after _, err = executeRequest(address, contextContextID, cookie, "Firewall", "commit", map[string]any{})) ``` -------------------------------- ### Create IPv4 Port Forwarding Rule Programmatically Source: https://context7.com/maelvls/livebox/llms.txt Programmatically creates an IPv4 TCP port forwarding rule by constructing a parameters map and executing an API request. The parameters include rule ID, description, external and internal ports, destination IP and MAC addresses, enablement status, persistence, protocol (6 for TCP), source interface, origin, and IP version. ```go // Create port forwarding rule programmatically params := map[string]any{ "id": "webui_myrule", "description": "myrule", "externalPort": "443", "internalPort": "443", "destinationIPAddress": "192.168.1.160", "destinationMACAddress": "e4:5f:01:a6:65:fe", "enable": true, "persistent": true, "protocol": "6", // 6=TCP, 17=UDP "sourceInterface": "data", "origin": "webui", "ipversion": 4, } response, err := executeRequest(address, contextID, cookie, "Firewall", "setPortForwarding", params) ``` -------------------------------- ### Wi-Fi Configuration API Source: https://context7.com/maelvls/livebox/llms.txt Manages wireless network settings for both 2.4GHz and 5GHz bands, including SSID, password, and band-specific configurations. ```APIDOC ## Wi-Fi Configuration API ### Description Manage wireless network settings for both 2.4GHz and 5GHz bands. You can configure common settings for both bands or specify settings for each band individually. ### Method POST ### Endpoint /NeMo.Intf.lan/setWLANConfig ### Parameters #### Request Body - **mibs.wlanvap** (object) - Required - Contains configuration for wireless interfaces. - **wl0** (object) - Configuration for the 2.4GHz band. - **SSID** (string) - Required - The network name (SSID). - **SSIDAdvertisementEnabled** (boolean) - Required - Whether to broadcast the SSID. - **Security** (object) - Security settings. - **ModeEnabled** (string) - Required - Security mode (e.g., "WP2-Personal"). - **KeyPassPhrase** (string) - Required - The Wi-Fi password. - **MACFiltering** (object) - MAC filtering settings. - **Mode** (string) - Required - MAC filtering mode (e.g., "Off"). - **WPS** (object) - Wi-Fi Protected Setup settings. - **Enable** (boolean) - Required - Whether WPS is enabled. - **eth4** (object) - Configuration for the 5GHz band (may vary based on hardware). - (Same fields as wl0) ### Request Example ```json { "mibs": { "wlanvap": { "wl0": { "SSID": "MyNetwork", "SSIDAdvertisementEnabled": true, "Security": { "ModeEnabled": "WP2-Personal", "KeyPassPhrase": "mypassword" }, "MACFiltering": {"Mode": "Off"}, "WPS": {"Enable": false} }, "eth4": { "SSID": "MyNetwork_5G", "SSIDAdvertisementEnabled": true, "Security": { "ModeEnabled": "WP2-Personal", "KeyPassPhrase": "mypassword" }, "MACFiltering": {"Mode": "Off"}, "WPS": {"Enable": false} } } } } ``` ### Response #### Success Response (200) Indicates that the Wi-Fi configuration has been successfully applied. ``` -------------------------------- ### List Network Devices via CLI Source: https://context7.com/maelvls/livebox/llms.txt Lists all devices currently connected to the Livebox router, displaying their hostnames, IP addresses, and MAC addresses in a formatted table. This command is useful for network inventory and troubleshooting. ```bash # List all connected devices livebox ls # Output example: # ┌──────────────┬──────────────────┬───────────────────┐ # │ Name │ IP Address │ MAC Address │ # ├──────────────┼──────────────────┼───────────────────┤ # │ raspberry-pi │ 192.168.1.160 │ E4:5F:01:A6:65:FE │ # │ laptop │ 192.168.1.100 │ AA:BB:CC:DD:EE:FF │ # └──────────────┴──────────────────┴───────────────────┘ ``` -------------------------------- ### Authenticate Livebox Router via CLI Source: https://context7.com/maelvls/livebox/llms.txt Provides command-line methods for authenticating with the Livebox router. This includes interactive login prompts and direct authentication using flags for address, username, and password. Successful authentication results in configuration being saved to `~/.config/livebox.yml`. ```bash # Interactive login with prompts livebox login # Authenticate with command-line flags livebox --address 192.168.1.1 --username admin --password password123 ls # Configuration saved to ~/.config/livebox.yml # Format: # address: 192.168.1.1 # username: admin # password: password123 ``` -------------------------------- ### Configure Livebox DMZ Settings Source: https://context7.com/maelvls/livebox/llms.txt This snippet explains how to configure the Demilitarized Zone (DMZ) on a Livebox. It includes CLI commands to retrieve the current DMZ configuration, set the DMZ to a specific IP address, and remove the DMZ. The Go code shows how to programmatically set the DMZ by specifying the destination IP address and also how to retrieve the current DMZ configuration, noting a potential 'ErrNoDMZ' if none is set. ```bash # Get current DMZ configuration livebox dmz get # Output: 192.168.1.160 # Set DMZ to specific IP livebox dmz set 192.168.1.160 # Remove DMZ configuration livebox dmz rm ``` ```go // Set DMZ programmatically resp, err := executeRequest(address, contextID, cookie, "Firewall", "setDMZ", map[string]any{ "id": "webui", "sourceInterface": "data", "destinationIPAddress": "192.168.1.160", "enable": true, }) // Get DMZ configuration response, err := executeRequest(address, contextID, cookie, "Firewall", "getDMZ", map[string]any{}) // Parse result.status.webui.DestinationIPAddress // Returns ErrNoDMZ if no DMZ configured ``` -------------------------------- ### List Network Devices Programmatically Source: https://context7.com/maelvls/livebox/llms.txt Retrieves a list of connected network devices programmatically by sending an HTTP request to the router's API. The function `executeRequest` is used with specific parameters for topology diagnostics. The response is a JSON object that needs to be parsed to extract device information. ```go // Get devices programmatically response, err := executeRequest(address, contextID, cookie, "TopologyDiagnostics", "buildTopology", map[string]any{"SendXmlFile": false}) if err != nil { return err } // Parse response JSON to extract device information ``` -------------------------------- ### Manage IPv6 Pinhole Rules via CLI Source: https://context7.com/maelvls/livebox/llms.txt Manages IPv6 firewall pinhole rules, which allow incoming connections to specific internal devices. Commands are available to list existing pinholes and create new ones, specifying the rule name, destination port, IP address, MAC address, and protocol (UDP with `--udp` flag). ```bash # List IPv6 pinhole rules livebox pinhole ls # Create IPv6 pinhole (TCP) livebox pinhole set tailscale-pi-ipv6 \ --to-port 41642 \ --to-ip 192.168.1.160 \ --to-mac e4:5f:01:a6:65:fe # Create IPv6 pinhole (UDP) livebox pinhole set wireguard \ --to-port 51820 \ --to-ip 192.168.1.160 \ --to-mac e4:5f:01:a6:65:fe \ --udp ``` -------------------------------- ### Execute API Request in Go Source: https://context7.com/maelvls/livebox/llms.txt This Go function executes a raw API request to the Livebox router. It constructs the JSON payload, sets necessary headers (Authorization, Content-Type, X-Context), adds cookies, and sends the POST request to the /ws endpoint. It returns the response body as a string or an error if the request fails. Dependencies include the net/http, encoding/json, bytes, fmt, and io packages. ```go import ( "bytes" "encoding/json" "fmt" "io" "net/http" ) // Raw API request function func executeRequest(address, contextID string, cookie *http.Cookie, service, method string, parameters map[string]any) (string, error) { payload := map[string]any{ "service": service, "method": method, "parameters": parameters, } payloadBytes, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", fmt.Sprintf("http://%s/ws", address), bytes.NewBuffer(payloadBytes)) req.Header.Set("Authorization", "X-Sah "+contextID) req.Header.Set("Content-Type", "application/x-sah-ws-1-call+json") req.AddCookie(cookie) req.AddCookie(&http.Cookie{Name: "sah/contextId", Value: contextID}) req.Header.Set("X-Context", contextID) client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close() bodyBytes, _ := io.ReadAll(resp.Body) return string(bodyBytes), nil } ``` -------------------------------- ### DMZ Configuration API Source: https://context7.com/maelvls/livebox/llms.txt Manages the Demilitarized Zone (DMZ) settings, allowing all incoming ports to be forwarded to a single specified device on the network. ```APIDOC ## DMZ Configuration API ### Description Configure the demilitarized zone (DMZ) to forward all incoming ports to a single device on your network. This is often used for devices that require direct external access to all ports. ### Method POST ### Endpoint /Firewall/setDMZ ### Parameters #### Request Body - **id** (string) - Required - Identifier for the DMZ configuration. - **sourceInterface** (string) - Required - The interface from which traffic originates. - **destinationIPAddress** (string) - Required - The IP address of the device to which all ports will be forwarded. - **enable** (boolean) - Required - Whether to enable the DMZ configuration. ### Request Example ```json { "id": "webui", "sourceInterface": "data", "destinationIPAddress": "192.168.1.160", "enable": true } ``` ### Response #### Success Response (200) Indicates the DMZ configuration has been successfully set. #### Response Example (No specific success response body provided for setDMZ.) ### Get DMZ Configuration To retrieve the current DMZ configuration: ### Method POST ### Endpoint /Firewall/getDMZ ### Parameters (No parameters required for this call) ### Response #### Success Response (200) Returns the DMZ configuration details. The destination IP address can be parsed from `result.status.webui.DestinationIPAddress`. #### Error Response - **ErrNoDMZ**: Returned if no DMZ is currently configured. ``` -------------------------------- ### Authenticate Livebox Router Source: https://context7.com/maelvls/livebox/llms.txt Authenticates with the Livebox router using provided credentials and saves them to a local configuration file for future use. It returns a context ID and session cookie required for subsequent API requests. Dependencies include standard Go logging and error handling. ```go // Authenticate with Livebox router contextID, cookie, err := authenticate("192.168.1.1", "admin", "password123") if err != nil { log.Fatal(err) } // Returns contextID string and session cookie for subsequent requests ``` -------------------------------- ### Raw API Request Function Source: https://context7.com/maelvls/livebox/llms.txt This Go function demonstrates how to execute a raw API request to the Livebox router. It handles request payload construction, authentication headers, cookie management, and response body reading. ```APIDOC ## POST /ws ### Description Executes a raw API request to the Livebox router's WebSocket endpoint. This function is used internally by the CLI to send service calls and receive responses. ### Method POST ### Endpoint `/ws` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **service** (string) - Required - The name of the service to call. - **method** (string) - Required - The method of the service to call. - **parameters** (map[string]any) - Required - A map of parameters for the method call. ### Request Example ```json { "service": "some_service", "method": "some_method", "parameters": { "param1": "value1", "param2": 123 } } ``` ### Response #### Success Response (200) - **body** (string) - The raw string response from the server, typically in JSON format. #### Response Example ```json { "result": "some_response_data" } ``` ### Headers - **Authorization**: `X-Sah {contextID}` - **Content-Type**: `application/x-sah-ws-1-call+json` - **Cookie**: `sessionID={session_id}` - **Cookie**: `sah/contextId={contextID}` - **X-Context**: `{contextID}` - **Host**: `livebox` or `192.168.1.1` (depending on the router's configuration) ``` -------------------------------- ### List static DHCP leases with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Lists all configured static DHCP leases on the Livebox router. This command helps in reviewing the current static IP assignments for devices on the network. ```bash livebox static-lease ls ``` -------------------------------- ### Manage Livebox Pinhole Rules Source: https://context7.com/maelvls/livebox/llms.txt This snippet covers the management of network pinhole rules on a Livebox device. It includes commands to remove existing pinhole rules and Go code to programmatically set up new IPv6 pinholes, specifying parameters like destination IP, port, and protocol. Note that a 'commit' operation is required after setting a pinhole. ```bash livebox pinhole rm tailscale-pi-ipv6 ``` -------------------------------- ### Raw API Access Source: https://context7.com/maelvls/livebox/llms.txt Provides direct access to execute arbitrary API calls by sending JSON payloads to standard input. ```APIDOC ## Raw API Access ### Description Execute arbitrary API calls by piping JSON payloads to standard input. This allows for flexible and direct interaction with any available Livebox API service and method. ### Method POST ### Endpoint /api ### Parameters #### Request Body - **service** (string) - Required - The API service to call (e.g., "NeMo.Intf.lan"). - **method** (string) - Required - The method of the service to call (e.g., "getMIBs"). - **parameters** (object) - Optional - Parameters for the method call. ### Request Example 1: Get MIBs ```json { "service": "NeMo.Intf.lan", "method": "getMIBs", "parameters": { "mibs": "base wlanradio" } } ``` ### Request Example 2: Get Phone Call List ```json { "service": "VoiceService.VoiceApplication", "method": "getCallList", "parameters": { "line": "1" } } ``` ### Response #### Success Response (200) Returns the result of the executed API call. ``` -------------------------------- ### Set up IPv6 pinhole with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Configures IPv6 pinholes for specific protocols and ports. This command is used to allow incoming traffic on specified IPv6 ports to reach a device on the local network, identified by its IP and MAC address. The --udp flag can be used to specify UDP traffic. ```bash livebox pinhole set tailscale-pi-ipv6 --to-port 41642 --to-ip 192.168.1.160 --to-mac e4:5f:01:a6:65:fe --udp ``` -------------------------------- ### Manage IPv4 Port Forwarding via CLI Source: https://context7.com/maelvls/livebox/llms.txt Manages IPv4 TCP/UDP port forwarding rules on the Livebox router. Commands allow listing existing rules, creating new rules (specifying protocol, ports, destination IP and MAC), and removing rules by name or ID. UDP rules can be created using the `--udp` flag. ```bash # List all port forwarding rules livebox port-forward ls # Create TCP port forwarding rule livebox port-forward set pi443 \ --from-port 443 \ --to-port 443 \ --to-ip 192.168.1.160 \ --to-mac E4:5F:01:A6:65:FE # Create UDP port forwarding rule livebox port-forward set dns-server \ --from-port 53 \ --to-port 53 \ --to-ip 192.168.1.10 \ --to-mac AA:BB:CC:DD:EE:FF \ --udp # Remove port forwarding rule (by name or ID) livebox port-forward rm pi443 livebox port-forward rm webui_pi443 ``` -------------------------------- ### Login to livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Initiates the login process for the livebox CLI. This is typically the first step before executing other commands that require authentication or connection to the Livebox router. ```bash livebox login ``` -------------------------------- ### Static DHCP Leases API Source: https://context7.com/maelvls/livebox/llms.txt Manages static DHCP lease assignments, allowing specific IP addresses to be reserved for devices based on their MAC addresses. ```APIDOC ## Static DHCP Leases API ### Description Configure static IP address assignments for devices on the local network. This ensures that specific devices always receive the same IP address from the DHCP server. ### Method POST ### Endpoint /DHCPv4.Server.Pool.default/addStaticLease ### Parameters #### Request Body - **MACAddress** (string) - Required - The MAC address of the device. - **IPAddress** (string) - Required - The static IP address to assign to the device. ### Request Example ```json { "MACAddress": "bc:d0:74:32:e9:1a", "IPAddress": "192.168.1.155" } ``` ### Response #### Success Response (200) Indicates successful addition or update of a static lease. #### Error Handling - **393221**: IP address already reserved. The provided IP address is already assigned to another static lease or is in use. ### Response Example (Success response details not specified, but error handling for specific codes is provided.) ``` -------------------------------- ### Pinhole Rule Management API Source: https://context7.com/maelvls/livebox/llms.txt Allows programmatic management of pinhole rules for network traffic. Supports setting IPv6 pinhole rules. ```APIDOC ## Pinhole Rule Management API ### Description Manages pinhole rules to control network traffic. This endpoint specifically supports setting IPv6 pinhole rules. ### Method POST ### Endpoint /Firewall/setPinhole ### Parameters #### Request Body - **id** (string) - Required - Identifier for the pinhole rule. - **origin** (string) - Required - Origin of the rule configuration (e.g., "webui"). - **sourceInterface** (string) - Required - The interface from which traffic originates. - **destinationPort** (string) - Required - The destination port for the rule. - **destinationIPAddress** (string) - Required - The destination IP address. - **destinationMACAddress** (string) - Required - The destination MAC address. - **protocol** (string) - Required - Protocol number (6 for TCP, 17 for UDP). - **ipversion** (integer) - Required - IP version (4 or 6). - **enable** (boolean) - Required - Whether to enable the pinhole rule. - **persistent** (boolean) - Required - Whether the rule should persist after reboot. ### Request Example ```json { "id": "mypinhole", "origin": "webui", "sourceInterface": "data", "destinationPort": "41642", "destinationIPAddress": "192.168.1.160", "destinationMACAddress": "e4:5f:01:a6:65:fe", "protocol": "6", "ipversion": 6, "enable": true, "persistent": true } ``` ### Response #### Success Response (200) Details of the API call's success. A subsequent `commit` call is required. #### Response Example (No specific success response body provided for setPinhole, but a commit call is needed.) ### Post-action After `setPinhole`, a `commit` call is mandatory: ```go // Must call commit after _, err = executeRequest(address, contextID, cookie, "Firewall", "commit", map[string]any{}) ``` ``` -------------------------------- ### Authentication API Source: https://context7.com/maelvls/livebox/llms.txt Authenticate with the Livebox router and save credentials. This process establishes a session using cookies and context IDs for subsequent API interactions. ```APIDOC ## Authentication API ### Description Authenticate with the Livebox router and save credentials to a local configuration file. This process establishes a session using cookies and context IDs for subsequent API interactions. ### Method POST (implicitly, via `livebox login` command or `authenticate` function) ### Endpoint N/A (local command execution or internal API call) ### Parameters #### Command-line Flags - **--address** (string) - Optional - The IP address of the Livebox router. - **--username** (string) - Optional - The username for router authentication. - **--password** (string) - Optional - The password for router authentication. #### Configuration File (`~/.config/livebox.yml`) - **address** (string) - The IP address of the Livebox router. - **username** (string) - The username for router authentication. - **password** (string) - The password for router authentication. ### Request Example ```bash # Interactive login livebox login # With flags livebox --address 192.168.1.1 --username admin --password password123 ls ``` ### Response #### Success Response - Session cookies and context ID are returned and stored locally. #### Response Example ```go // contextID string and cookie string are returned upon successful authentication ``` ``` -------------------------------- ### Set up static DHCP lease with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Assigns a static IP address to a device on the network based on its MAC address. This ensures that a specific device always receives the same IP address from the DHCP server, which is useful for servers or devices that need a consistent IP. ```bash livebox static-lease set bc:d0:74:32:e9:1a 192.168.1.155 ``` -------------------------------- ### List Network Devices API Source: https://context7.com/maelvls/livebox/llms.txt Retrieve a list of all devices currently connected to the Livebox router, including their IP and MAC addresses. ```APIDOC ## List Network Devices API ### Description Retrieve a list of all devices currently connected to the Livebox router, including their IP and MAC addresses. This command helps in network inventory and troubleshooting. ### Method GET (implicitly, via `livebox ls` command or `executeRequest` function) ### Endpoint N/A (command execution or internal API call) ### Parameters None for the `ls` command. ### Request Example ```bash # List all connected devices livebox ls ``` ### Response #### Success Response A table listing connected devices with their Name, IP Address, and MAC Address. #### Response Example ```text ┌──────────────┬──────────────────┬───────────────────┐ │ Name │ IP Address │ MAC Address │ ├──────────────┼──────────────────┼───────────────────┤ │ raspberry-pi │ 192.168.1.160 │ E4:5F:01:A6:65:FE │ │ laptop │ 192.168.1.100 │ AA:BB:CC:DD:EE:FF │ └──────────────┴──────────────────┴───────────────────┘ ``` ```go // Example programmatic call to retrieve devices response, err := executeRequest(address, contextID, cookie, "TopologyDiagnostics", "buildTopology", map[string]any{"SendXmlFile": false}) if err != nil { // Handle error } // Parse response JSON to extract device information ``` ``` -------------------------------- ### DNS Names API Source: https://context7.com/maelvls/livebox/llms.txt Allows setting custom DNS names for devices connected to the local network, identified by their MAC addresses. ```APIDOC ## DNS Names API ### Description Set custom DNS names for devices on your local network. This makes it easier to identify devices by name instead of just their IP or MAC address when accessing them within the network. ### Method POST ### Endpoint /Devices.Device.[MACAddress]/setName ### Parameters #### Path Parameters - **MACAddress** (string) - Required - The MAC address of the device (e.g., "d8:10:68:8a:e9:c4"). Must be in lowercase. #### Request Body - **name** (string) - Required - The custom DNS name to assign to the device. - **source** (string) - Required - The source of the name (e.g., "dns"). ### Request Example ```json { "name": "my-custom-name", "source": "dns" } ``` ### Response #### Success Response (200) Indicates that the DNS name has been successfully set for the device. ``` -------------------------------- ### Check DSL Speed via CLI Source: https://context7.com/maelvls/livebox/llms.txt Displays the current downstream and upstream speeds of the DSL connection. This command is specific to DSL connections and will not function with fiber optic connections. The output is presented in Mbps. ```bash # Check DSL bandwidth livebox speed # Output example: # ↓ 15.2 Mbps # ↑ 0.9 Mbps ``` -------------------------------- ### Configure Wi-Fi SSID and password for both bands Source: https://github.com/maelvls/livebox/blob/main/README.md Configures the Wi-Fi network name (SSID) and password for both the 2.4 GHz and 5 GHz bands simultaneously. If the --24ghz and --5ghz flags are omitted, both bands are configured with the provided settings. ```bash livebox wifi config --ssid "Wifi-Valais" --pass "foobar" --24ghz --5ghz ``` ```bash livebox wifi config --ssid "Wifi-Valais" --pass "foobar" ``` -------------------------------- ### List network devices with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Lists network devices connected to the Livebox router, providing their IP and MAC addresses. This command is useful for network discovery and identifying devices on the local network. ```bash livebox ls ``` -------------------------------- ### Set up IPv4 TCP port forwarding with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Configures IPv4 TCP port forwarding rules on the Livebox router. This command specifies the name of the rule, the external port to forward, the internal port, and the IP and MAC address of the target device on the local network. The --udp flag can be used to forward UDP traffic instead. ```bash livebox port-forward set pi443 --from-port 443 --to-port 443 --to-ip 192.168.1.160 --to-mac E4:5F:01:A6:65:FE ``` -------------------------------- ### Check DSL bandwidth with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Displays the DSL connection's bandwidth. Note that this command is specifically for DSL connections and does not work with fiber connections. It helps in monitoring the internet speed. ```bash livebox speed ``` -------------------------------- ### Configure separate Wi-Fi settings for 2.4GHz and 5GHz bands Source: https://github.com/maelvls/livebox/blob/main/README.md Allows setting different SSIDs and passwords for the 2.4 GHz and 5 GHz Wi-Fi bands independently. This provides granular control over wireless network configurations. ```bash livebox wifi config --24ghz --ssid "Wifi-Valais" --pass "foobar" ``` ```bash livebox wifi config --5ghz --ssid "Wifi-Valais_5GHz" --pass "foobar" ``` -------------------------------- ### Reboot Livebox Router Programmatically Source: https://context7.com/maelvls/livebox/llms.txt Triggers a remote reboot of the Livebox router programmatically by making an API call. The `executeRequest` function is used with parameters specifying the 'NMC' module and 'reboot' method, including a reason for the reboot. ```go // Reboot programmatically _, err = executeRequest(address, contextID, cookie, "NMC", "reboot", map[string]any{"reason": "GUI_Reboot"}) if err != nil { return fmt.Errorf("reboot failed: %w", err) } ``` -------------------------------- ### Reboot Router API Source: https://context7.com/maelvls/livebox/llms.txt Initiate a remote reboot of the Livebox router. This is useful for restarting services or applying configuration changes. ```APIDOC ## Reboot Router API ### Description Initiate a remote reboot of the Livebox router. This is useful for restarting services or applying configuration changes. ### Method POST (implicitly, via `livebox reboot` command or `executeRequest` function) ### Endpoint N/A (command execution or internal API call) ### Parameters #### `executeRequest` Parameters - **module**: "NMC" - **method**: "reboot" - **params**: `map[string]any{"reason": "GUI_Reboot"}` ### Request Example ```bash # Reboot the Livebox livebox reboot ``` ### Response #### Success Response A confirmation message indicating the router is rebooting. #### Response Example ```text Livebox is rebooting... ``` ```go // Example programmatic reboot call _, err = executeRequest(address, contextID, cookie, "NMC", "reboot", map[string]any{"reason": "GUI_Reboot"}) if err != nil { // Handle error } ``` ``` -------------------------------- ### Configure DMZ with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Sets a device on the local network to be in the Demilitarized Zone (DMZ). All incoming traffic that is not specifically forwarded by other rules will be directed to this device. This is often used for gaming consoles or servers requiring direct external access. ```bash livebox dmz set 192.168.1.160 ``` -------------------------------- ### Perform raw API calls with livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Allows sending raw API requests to the Livebox router. This enables advanced users to interact with specific router services and methods not directly exposed by other CLI commands. The input is a JSON string defining the service, method, and parameters. ```bash livebox api <<<'{"service":"NeMo.Intf.lan","method":"getMIBs","parameters":{"mibs":"base wlanradio"}}' ``` -------------------------------- ### IPv6 Pinhole API Source: https://context7.com/maelvls/livebox/llms.txt Manage IPv6 firewall pinhole rules on the Livebox router. These rules allow incoming IPv6 connections to specific internal devices. ```APIDOC ## IPv6 Pinhole API ### Description Manage IPv6 firewall pinhole rules on the Livebox router. These rules allow incoming IPv6 connections to specific internal devices. ### Method POST (implicitly, via `livebox pinhole` commands or `executeRequest` function) ### Endpoint N/A (command execution or internal API call) ### Parameters #### `livebox pinhole` Subcommands & Flags - **ls**: Lists all current IPv6 pinhole rules. - **set [name]**: Creates or updates an IPv6 pinhole rule. - **--to-port** (int) - Required - The destination port for the incoming connection. - **--to-ip** (string) - Required - The destination IPv6 address of the internal device. - **--to-mac** (string) - Required - The destination MAC address of the internal device. - **--udp** - Optional - Use UDP protocol instead of TCP (default). - **rm [name/ID]**: Removes an IPv6 pinhole rule by its name or ID. ### Request Example ```bash # List IPv6 pinhole rules livebox pinhole ls # Create TCP IPv6 pinhole livebox pinhole set tailscale-pi-ipv6 --to-port 41642 --to-ip 192.168.1.160 --to-mac e4:5f:01:a6:65:fe # Create UDP IPv6 pinhole livebox pinhole set wireguard --to-port 51820 --to-ip 192.168.1.160 --to-mac e4:5f:01:a6:65:fe --udp ``` ### Response #### Success Response Confirmation of the action taken (e.g., rule created, listed, or removed). #### Response Example ```go // The internal API call for pinhole management would likely mirror the structure // of port forwarding but with 'ipversion' set to 6 and potentially different // module/method names within the Livebox API. // Example conceptual call: // response, err := executeRequest(address, contextID, cookie, // "Firewall", "setIPv6Pinhole", pinholeParams) ``` ``` -------------------------------- ### DSL Speed Check API Source: https://context7.com/maelvls/livebox/llms.txt Display the current DSL connection speeds, including downstream and upstream rates. This feature is applicable only to DSL connections. ```APIDOC ## DSL Speed Check API ### Description Display the current DSL connection speeds, including downstream and upstream rates. This feature is applicable only to DSL connections, not fiber. ### Method GET (implicitly, via `livebox speed` command or `executeRequest` function) ### Endpoint N/A (command execution or internal API call) ### Parameters #### `executeRequest` Parameters - **module**: "NeMo.Intf.data" - **method**: "getMIBs" - **params**: `map[string]any{"mibs": "dsl"}` ### Request Example ```bash # Check DSL bandwidth livebox speed ``` ### Response #### Success Response The downstream and upstream speeds of the DSL connection. #### Response Example ```text ↓ 15.2 Mbps ↑ 0.9 Mbps ``` ```go // Example programmatic call to get DSL speed response, err := executeRequest(address, contextID, cookie, "NeMo.Intf.data", "getMIBs", map[string]any{"mibs": "dsl"}) if err != nil { // Handle error } // Parse result.status.dsl.dsl0.DownstreamCurrRate and UpstreamCurrRate // Convert from Kbps: rate * 0.96 / 1000 = Mbps ``` ``` -------------------------------- ### Enable/Disable Wi-Fi bands using livebox CLI Source: https://github.com/maelvls/livebox/blob/main/README.md Enables or disables the 2.4 GHz and 5 GHz Wi-Fi bands. Commands can be used to toggle both bands or specific bands individually. ```bash livebox wifi disable livebox wifi enable ``` ```bash livebox wifi disable --24ghz livebox wifi enable --5ghz ```