/livebox-api

📶 API de administración del router livebox realizada mediante ingeniería inversa para consultar/modificar datos como configuración WIFI, NAT, softphones, dns, firewall, etc.

Primary LanguageJavaScriptMIT LicenseMIT

LiveBox API

License Maintenance GitHub package.json version

EN: 📶 This api is packed full with all functions from administration website from the livebox router, and extract/modify data. This includes WIFI configuration, NAT, softphones, DNS, firewall, etc.

ES: Esta api permite todas las funciones disponibles en la pagina de administración del router livebox y extraer/modificar datos. Esto incluye configuración WIFI, configuración NAT, softphones, dns, firewall, etc.


Developer usage

Set up project

Before cloning the repo be sure you have installed:

  • NODE (version >= v12.16.x)
  • NPM (version >= 6.14.x)

Then:

  • Choose a folder project in your system and switch in cd [folder path]
  • Clone the repo in your folder path git clone https://github.com/EHF32/livebox-api.git

Installation

In order to install the project and all dependencies, enter in the project folder and run npm install


Start Server using node

npm run start

Start Server using hot reload

npm run watch

Configure your session

Go to src/constants/config.js and change this values to your credentials.

module.exports = {
  autologin: true,
  user: "admin",
  password: "12345678",
  url: "http://192.168.1.1",
  ...
}

It's recommended to enable autologin, this will login every time you make a request, but if you are going to make a lot of request in short amount of time, instead pass the token manually.


Request & Response Examples

Examples using the API

login

To login into the router:

// http://localhost:3000/api/v1/login
login().then(token => {
    console.log(token);
  })

With this you receive a token, that let you use all the others functions. It is not necesary if you have enabled autologin in src/constants/config.js.

Example: turn ON/OFF wifi and other options

Example, sending a POST request to http://localhost:3000/api/v1/wifi_main with this body params:

{
	  "wlan_enable1": "0"
}

The 0 means to turn off, and 1 to turn on the wifi. We can send all the parameters we want to change, for example:

{
          "wlan_enable1": "1",
	  "bss_broadcast1": "1",
	  "bss_broadcast6": "1"
}

This example will enable wifi, and set wifi to visible.

The list of all parameters is on /parameter list folder here You have to send the request to the file of the container of the param, for example if you want to change lan_port1 on nat params, make the request to /api/v1/nat

full list on:

//http://localhost:3000/api/v1/
{
  "message": "LiveBox API v1 👋",
  "author": "Ángel Herrador",
  "entries": {
    "wifi_main": "/api/v1/wifi_main",
    "phones": "/api/v1/phones",
    "softphones": "/api/v1/softphones",
    "system": "/api/v1/system",
    "lan": "/api/v1/lan",
    "status": "/api/v1/status",
    "nat": "/api/v1/nat",
    "dns": "/api/v1/dns",
    "upnp": "/api/v1/upnp",
    "ddns": "/api/v1/ddns",
    "fw_dmz": "/api/v1/fw_dmz",
    "ntp": "/api/v1/ntp",
    "firewall": "/api/v1/firewall",
    "remote_mgmt": "/api/v1/remote_mgmt",
    "infoWifi": "/api/v1/infoWifi",
    "infoLan": "/api/v1/infoLan",
    "infoSip": "/api/v1/infoSip"
  }
}
url parameter-list
/api/v1/wifi_main wifi_main.md
/api/v1/phones phones.md
/api/v1/softphones softphones.md
/api/v1/system system.md
/api/v1/lan lan.md
/api/v1/status status.md
/api/v1/nat nat.md
/api/v1/dns dns.md
/api/v1/upnp upnp.md
/api/v1/ddns ddns.md
/api/v1/fw_dmz fw_dmz.md
/api/v1/ntp ntp.md
/api/v1/firewall firewall.md
/api/v1/remote_mgmt remote_mgmt.md
/api/v1/infoWifi infoWifi.md
/api/v1/infoLan infoLan.md
/api/v1/infoSip infoSip.md

Example: read wifi status and other options

Following the last example, if we want now to get the value of especific param, we do the same process, but in this case with GET method.

// BODY GET: http://localhost:3000/api/v1/wifi_main
[
	"wlan_enable1",
	"bss_broadcast1",
	"bss_broadcast6"
]

We get this result:

// RESULT: http://localhost:3000/api/v1/wifi_main
{
  "wlan_enable1": "0",
  "bss_broadcast1": "1",
  "bss_broadcast6": "1"
}

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/NewFeature)
  3. Commit your Changes (git commit -m 'Add some NewFeature')
  4. Push to the Branch (git push origin feature/NewFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Ángel Herrador - GitHub