New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fritzbox

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fritzbox

Fritzbox - UPnP/IGD for node.js

latest
Source
npmnpm
Version
1.1.4
Version published
Weekly downloads
104
5.05%
Maintainers
1
Weekly downloads
 
Created
Source

Fritz!Box (fritzbox)

Description

A library to connect to the TR-064 and UPnP API of an AVM Fritz!Box and to interact with it.

This library is capable of:

  • Supports the UPnP and TR-064 specification of the Fritz!Box
  • Call actions of services
  • Authentication with username/password on http authentication level
  • SSL encryption with custom port settings
  • Using promises instead of callbacks
  • Subscribe to Events with included EventServer (not working at the moment)

More info about capabilities provided by the TR-064 specification: http://www.avm.de/de/Extern/files/tr-064/AVM_TR-064_first_steps.pdf

Special thanks

This library is a complete rework of the tr-064 library from Hendrik Westerberg. Thanks for the initial work.

Install

  npm install tr-064

It is simple

Connect to the device and read a Service.

var Fritzbox = require('fritzbox');
var options = {
  host: 'fritz.box',
  port: 49000,
  ssl: false,
  user: 'username',
  password: 'password'
}

var fritzbox = new Fritzbox(options);

fritzbox.initTR064Device().then(function(){
    console.log('Successfully initialized device');
    var wanip = fritzbox.services["urn:dslforum-org:service:WANIPConnection:1"];
    return wanip.actions.GetInfo();
  }).then(function(result) {
    console.log(result);
  }).catch(function(error) {
    console.log(error);
  });

List All Services and Variables

Get the info from both protocols.

var Fritzbox = require("./lib/Fritzbox");
var Promise = require("bluebird");

var options = {
  host: 'fritz.box',
  port: 49000,
  ssl: false,
  user: 'username',
  password: 'password'
}

var fritzbox = new Fritzbox.Fritzbox(options);

//Initialize Device
Promise.all([fritzbox.initTR064Device(), fritzbox.initIGDDevice()])
//Print information about available services
  .then(function() {
    for (var serviceName in box.services) {
      console.log("=== "+serviceName+" ===");
      for (var actionName in box.services[serviceName].actionsInfo) {
        console.log("   # " + actionName + "()");
        box.services[serviceName].actionsInfo[actionName].inArgs.forEach(function(arg) {
          console.log("     IN : " + arg);
        });
        box.services[serviceName].actionsInfo[actionName].outArgs.forEach(function(arg) {
          console.log("     OUT : " + arg);
        });
      }
    }
  })

Methods

fritzbox.initTR064Device()

Initialize the TR - 064 UPnP controller and adds the TR-064 services to the services array.

Returns

  • Promise

fritzbox.initIGDDevice()

Initialize the TR - 064 IGD controller and adds the IGD services to the services array.

Returns

  • Promise

Keywords

TR-064

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts