Project

keenetic

0.0
The project is in a healthy, maintained state
A Ruby client for interacting with Keenetic router REST API. Supports authentication, device management, system monitoring, and network interfaces.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.0
~> 1.4
 Project Readme

Keenetic

Ruby wrapper for the Keenetic router RCI (Remote Command Interface) — the same API that powers the Keenetic web UI.

Installation

gem 'keenetic'

Configuration

Keenetic.configure do |config|
  config.host = '192.168.1.1'
  config.login = 'admin'
  config.password = 'your_password'
  config.timeout = 30               # optional
  config.logger = Logger.new($stdout) # optional
end

Quick Start

client = Keenetic.client

# System info
client.system.info              # model, firmware
client.system.resources         # CPU, memory, uptime

# Connected devices
client.devices.all              # all registered devices
client.devices.active           # currently connected

# Network
client.network.interfaces       # all interfaces
client.wifi.access_points       # Wi-Fi networks
client.internet.status          # internet connectivity

# Port forwarding
client.nat.rules                # NAT rules
client.nat.add_forward(index: 1, protocol: 'tcp', port: 8080, 
                       to_host: '192.168.1.100', to_port: 80)

# VPN
client.vpn.status               # VPN server status
client.vpn.clients              # connected VPN clients

# Configuration
client.system_config.save       # save to flash
client.system_config.download   # backup config

Error Handling

begin
  client.devices.all
rescue Keenetic::AuthenticationError
  # invalid credentials
rescue Keenetic::ConnectionError
  # router unreachable
rescue Keenetic::TimeoutError
  # request timed out
rescue Keenetic::ApiError => e
  # other API errors
  e.status_code
  e.response_body
end

Documentation

Requirements

  • Ruby >= 3.0

License

MIT