Git Product home page Git Product logo

livebox-api's Introduction

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

livebox-api's People

Contributors

ehf32 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

suniron

livebox-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.