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

netasqcomm

v0.2.0

Published

A comm library and a CLI to connect to NETASQ security appliances

Downloads

5

Readme

node-netasqcomm Build Status

This is a NETASQ security appliance comm library for node.js. It contains also a cli: nncli (NETASQ Node CLI)

  • http://www.netasq.com
  • http://nodejs.org

Installation with npm

Installing npm (node package manager: http://npmjs.org/)

curl http://npmjs.org/install.sh || sh	

Installing netasqcomm

[sudo] npm install [-g] netasqcomm

nncli (bin) will be only available with global (-g) option.

Usage

Basic

var
session = require('../lib/netasqcomm').createSession({
		login: 'admin',
		pwd: 'adminadmin',
		host: '10.0.0.254',
		verbose: false // true if you want debug logs
});


session.on('error', function(error) {
		if (error) {
			console.log('Session error (%s): %s', error.code, error.message);	
		} else {
			console.log('Session error occured (no details)');
		}
		process.exit(1);
});

session.connect(function() {
		console.log('Logged in.');
		console.log('Session level: %s', session.sessionLevel);		
		session.exec('help', function(response){
				response.dumpServerdData();
				session.exec('quit', function(response){
						response.dumpServerdData();
				})
		})
});                                     
		

Examples

  • examples/basic.js
  • bin/nncli.js

Exports

Session class

/**
* @class
* @inherits EventEmitter
* @event error({exception}) > {code, message, ...}
* @event connected()
* @event commandResponse({string} session level)
* @event downloaded()
* @event disconnected()
* @params {object} config
* @see SESSION_ERRORS
* @see SESSION_ERRORS_MSG
* @see SESSION_LEVELS
*/

Session Methods

  • connect
/**
* @public
* @method
* Connect to NETASQ appliance
* @param [{function} callback], optionnal, use a callback or 'connected' event
* @see SESSION_ERRORS,
* @see 'connected' event
* @see 'error' event
*/
  • disconnect
/**
* @public
* Run exec() with quit command 
* @param [{function} cb({object} data)], optionnal, use a callback or 'commandResponse' event OR 'disconnected' event
*/
  • exec
/**
* @public
* @method
* Run a command
* @param {string} command
* @param [{function} cb({object}data)], optionnal, use a callback or 'commandResponse' event
* @see 'commandResponse' event
*/
  • download
/**
* @public
* @params {object} wStream: Writable Stream
* @params {string} fileName
* @param [{function} cb({object}data)], optionnal, use a callback or 'downloaded' event
*/
  • upload
/**
* @public
* @params {string} fileName
* @param [{function} cb({object}data)], optionnal, use a callback or 'uploaded' event
*/

Session Events

  • error
  • connected
  • commandResponse
  • downloaded
  • uploaded
  • disconnected

Session Properties

  • TODO

Functions

  • dumpServerdObject
/**
* Dump to writable stream serverd object as a human readable format (ini style),
* function of served format
* @public 
* @param {object} serverd: part of returned data
* @param [{object}] ws: Writable Stream. Optionnal. Default to process.stdout
* @see Session.exec
* @see test/netasqcomm-*-format.js
* @example
* session.exec('help', function(data){
* 		netasqComm.dumpServerdObject(data.nws.serverd); // This will dump data to stdout
* })
*/
  • getObjectValue
/**
* @public
* @returns obj reference value related to str path
* @throw error if property does not exists
* @example
*	foo: {
*		bar: 'value'
* 	}
* 	getObjectValue('foo.bar', foo) returns 'value'
* 	getObjectValue('help', foo) throw an error
*/

Consts

  • SESSION_ERRORS: Object of Number properties.

    • AUTH_FAILED
    • LOGIN_FAILED
    • TOO_MANY_USER_AUTHENTICATED
  • SESSION_ERRORS_MSG: Object of String properties.

    • AUTH_FAILED
    • LOGIN_FAILED
    • TOO_MANY_USER_AUTHENTICATED
  • SESSION_LEVELS: Array of String:

    • modify
    • base
    • contentfilter
    • log
    • filter
    • vpn
    • log_read
    • pki
    • object
    • user
    • admin
    • network
    • route
    • maintenance
    • asq
    • pvm
    • vpn_read
    • filter_read
    • globalobject
    • globalfilter
  • SERVERD: Object of Number properties.

    • OK: 100// Success one line
    • OK_MULTI_LINES: 101// Success multiple lines
    • OK_SERVER_WAITING_MULTI_LINES: 102// Success: serverd is waiting for data
    • OK_DISCONNECTED: 103// Success: session is closed
    • OK_SERVER_NEED_REBOOT: 104// Success but appliance should be restarted (in order to apply modifications)
    • WARNING_OK: 110// Success but one warning
    • WARNING_OK_MULTI_LINE: 111,// Success but multiple warning
    • KO: 200// Failure one line
    • KO_MULTI_LINES: 201// Failure multiple line
    • KO_AUTH: 202// Authentication failed
    • KO_TIMEOUT_DISCONNECTED: 203// Failure: timout disonnected (no activity)
    • KO_MAXIMUM_ADMIN_REACH: 204// Failure: maximum administrator are connected to appliance
    • KO_LEVEL: 205// Administator do not have enought level to run specified command
    • KO_LICENCE: 206// Appliance do not have licence option to run specified command

Known issues

  • Limited to NETASQ V9+ firmware (http(s), SRP is not supported)

Test

Just run npm test