npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tr-O64

v0.2.4

Published

TR-064 - UPnP/IGD for node.js

Downloads

1,237

Readme

tr-064

TR-064 - UPnP/IGD for node.js

Description

A library to interact with routers and other network devices. Tested and designd for Fritz.Box routers.

This library is capable of:

  • Supports the UPnP, IGD and PMR (Samsung TV) Protocol
  • Read and configure Services
  • Authentication with username/password or password only
  • SSL encryption
  • Transactions
  • Subscribe to Events with included EventServer

More info about TR-064: http://www.avm.de/de/Extern/files/tr-064/AVM_TR-064_first_steps.pdf

Install

It`s simple

Connect to the device and read a Service.

var tr = require("tr-064");
var tr064 = new tr.TR064();
tr064.initTR064Device("fritz.box", 49000, function (err, device) {
    if (!err) {
       var wanip = device.services["urn:dslforum-org:service:WANIPConnection:1"];
       wanip.actions.GetInfo(function(err, result){
       		console.log(result);
       });
    }
});

Save communication (SSL Encryption, Authentication)

var tr = require("tr-064");
var tr064 = new tr.TR064();
tr064.initTR064Device("fritz.box", 49000, function (err, device) {
    if (!err) {
        device.startEncryptedCommunication(function (err, sslDev) {
            if (!err) {
                sslDev.login([USER], [PASSWORD]);
                var wanip = sslDev.services["urn:dslforum-org:service:WANIPConnection:1"];
                wanip.actions.GetInfo(function (err, result) {
                    console.log(result);
                });
            }
        });
    }
});

List All Services and Variables

Get the info from both protocols.

var tr = require("tr-064");
var tr064 = new tr.TR064();
tr064.initTR064Device("fritz.box", 49000, function (err, device) {
    if (!err) {
        console.log("Found device! - TR-064");
        showDevice(device);
    }
});

tr064.initIGDDevice("fritz.box", 49000, function (err, device) {
    if (!err) {
        console.log("Found device! - IGD");
        showDevice(device);
    }
});

var showDevice = function (device) {
    console.log("=== " + device.meta.friendlyName + " ===");
    device.meta.servicesInfo.forEach(function (serviceType) {
        var service = device.services[serviceType];
        console.log("  ---> " + service.meta.serviceType + " <---");
        service.meta.actionsInfo.forEach(function (action) {
            console.log("   # " + action.name + "()");
            action.inArgs.forEach(function (arg) {
                console.log("     IN : " + arg);
            });
            action.outArgs.forEach(function (arg) {
                console.log("     OUT: " + arg);
            });
        });
    });
}

Methods

initTR064Device(host, port, callback)

Initialize the TR - 064 UPnP controller

  • host - hostname of the device
  • port - port of the device(standard: 49000)
  • callback - (err, device)

initIGDDevice(host, port, callback)

Initialize the TR - 064 IGD controller

  • host - hostname of the device
  • port - port of the device(standard: 49000)
  • callback - (err, device)

device.startEncryptedCommunication([caFile],callback)

Starts SSL encrypted Communication

  • caFile - Filename of custom .pem file (Optional)
  • callback - (err, device)

device.stopEncryptedCommunication()

Stops SSL encrypted Communication

device.login([user],password)

Configure device to use authentication for every request

  • user - Username (Optional, default device user is used instead)
  • password - Device password

device.logout()

Configure device to not use authentication

device.startTransaction(callback)

Starts a 'device-side' transaction

  • callback - (err, device)

device.stopTransaction()

Ends the current transaction

device.meta

Array with all info about services and actions

device.services[Service Identifier]

Gets the specified service form the device

  • Service Identifier - usually in the form of: urn:dslforum-org:service:XXX:1

service.actions.XXX([args], callback)

  • args - Array of args to configure or read a service.
  • callback - (err, result)