0.1.0 • Published 6 months ago

node-merlin-wrt-api v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

NodeMerlinWrtApi

The purpose of this project is to provide a library that can be used to

  • connect to a router running the Merlin Firmware
  • fetching infos regarding router, clients, traffic, etc.
  • running arbitrary commands (untested)

Installation

$# npm i --save node-merlin-wrt-api

Usage

"use strict";

const node_merlin_wrt_api = require("node-merlin-wrt-api");
(async () => {
    const api = new node_merlin_wrt_api.NodeMerlinWrtApi('admin', 'changeMe', 'https://192.168.1.1:8443', true);
    console.log('Api created');

    const token = await api.getAuthToken();
    console.log(`New Auth Token: "${token}"`);

    const data = await api.getClientList();
    console.log(`Recieved clients macs: ${JSON.stringify(data.macList)}`);

    await api.logout();
})().then(() => {
    process.exit();
}).catch(err => {
    console.error(err);
    process.exit(1);
});

Development

Start the dev-Container described in docker-compose.yml-file:

$# docker-compose run --rm dev ash
/src $

Debugging

whilst in the dev-containers shell, run:

$# npm run tsx -- --inspect-wait=0.0.0.0:9229 Example/example.ts

then attach your node inspector of choice to port 9229, e.g. with vscode and the following configuration:

.vscode/launch.json:

"configurations": [
  {
    "type": "node",
    "request": "attach",
    "name": "Docker: Attach to Node",
    "port": 9229,
    "remoteRoot": "/src",
    "localRoot": "${workspaceFolder}"
  },
]
0.1.0

6 months ago

0.0.2

7 months ago

0.0.2-alpha.6

7 months ago

0.0.2-alpha.5

3 years ago

0.0.2-alpha.4

3 years ago

0.0.2-alpha.3

3 years ago

0.0.2-alpha.2

3 years ago

0.0.2-alpha.1

3 years ago

0.0.2-alpha.0

3 years ago