New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

net-snmp

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

net-snmp - npm Package Compare versions

Comparing version 3.10.1 to 3.10.2

73

example/test.js

@@ -1,25 +0,62 @@

const snmp = require("../");
/* eslint-disable no-unused-vars */
const store = snmp.createModuleStore();
var snmp = require ("../");
var getopts = require ("getopts");
store.loadFromFile("/var/tmp/mibs/IANAifType-MIB.mib");
store.loadFromFile("/var/tmp/mibs/IF-MIB.mib");
var options = getopts(process.argv.slice(2));
var providers;
var mibDir = '/var/tmp/mibs/';
// const mod = store.getModule("IF-MIB");
var counter64 = function (num) {
var buf = Buffer.alloc (4);
buf.writeUInt32BE (num);
return buf;
};
//Object.keys(mod)
// .forEach(key => console.log(key));
var snmpOptions = {
disableAuthorization: options.n,
port: options.p,
engineID: options.e,
debug: options.d
};
//console.log(JSON.stringify(mod, null, 2));
const provs = store.getProvidersForModule('IF-MIB');
console.log(JSON.stringify(provs, null, 2));
var callback = function (error, data) {
if ( error ) {
console.error (error);
} else {
console.log (data.pdu.varbinds[0].oid);
}
};
var store = snmp.createModuleStore ();
var agent = snmp.createAgent (snmpOptions, callback);
var mib = agent.getMib ();
//const mod = store.getModule("CISCO-CONFIG-MAN-MIB");
//console.log(mod);
//console.log(JSON.stringify(mod.ccmHistoryEventTerminalUser, null, 2));
//console.log(JSON.stringify(mod.ciscoConfigManCTIDNotifyGroup, null, 2));
//console.log(JSON.stringify(mod.ciscoConfigManCTIDObjectGroup, null, 2));
//console.log(JSON.stringify(mod.HistoryEventMedium, null, 2));
//console.log(JSON.stringify(mod.ccmHistoryRunningLastChanged, null, 2));
//console.log(JSON.stringify(mod.ccmHistoryRunningLastSaved, null, 2));
var authorizer = agent.getAuthorizer ();
authorizer.addCommunity ("public");
// IF-MIB load and providers registration
store.loadFromFile (mibDir + "IANAifType-MIB.mib");
store.loadFromFile (mibDir + "IF-MIB.mib");
store.loadFromFile (mibDir + "HOST-RESOURCES-MIB.MIB");
store.loadFromFile (mibDir + "IANA-PRINTER-MIB.mib");
store.loadFromFile (mibDir + "IANA-CHARSET-MIB.mib");
store.loadFromFile (mibDir + "PRINTER-MIBv1.mib");
store.loadFromFile (mibDir + "JOB-MONITORING-MIB.mib");
// const mibModuleOid = store.translate('1.3.6.1.4.1', snmp.OidFormat.module);
// console.log('mibModuleOid: ', mibModuleOid);
// const mibOid = store.translate('Job-Monitoring-MIB::jmJobTable', snmp.OidFormat.oid);
// console.log('mibOid: ', mibOid);
console.log(store.translate('Job-Monitoring-MIB::jmJobTable', snmp.OidFormat.oid));
// ifNumber
// Scalar type - setScalarValue() and getScalarValue() are the entire API for these
// console.log("All modules: ", JSON.stringify(modules, '', 2));
const jobModule = store.getModule('Job-Monitoring-MIB');
console.log('jobModule: ', JSON.stringify(jobModule, null, 2));
// print IF-MIB
// const ifModule = store.getModule('IF-MIB');
// console.log('ifModule: ', JSON.stringify(ifModule, null, 2));

@@ -736,3 +736,3 @@ var fs = require('fs');

OID: function (OBJECT_IDENTIFIER, ID, ObjectName, OD, callback) {
let members = OBJECT_IDENTIFIER.split(" ");
let members = OBJECT_IDENTIFIER.split(/\s+/);
let parent = members.shift();

@@ -759,4 +759,25 @@ let oid = members.pop();

}
ID = ID == '' ? oid : [oid, ID].join('.');
OD = OD == '' ? parent : [parent, OD].join('.');
if (members.length > 0) {
// We have middle entries e.g. { enterprises pwg(2699) mibs(1) 1 }
let midID = [];
let midOD = [parent];
for (let entry of members) {
let match = entry.match(/(.*)\((.+)\)$/);
midID.push(match[2]);
midOD.push(match[1]);
}
midID.push(oid);
if ( ID != '' ) {
midID.push(ID);
}
if ( OD != '' ) {
midOD.push(OD);
}
ID = midID.join('.');
OD = midOD.join('.');
} else {
// We have no middle entries e.g. { enterprises 2021 }
ID = ID == '' ? oid : [oid, ID].join('.');
OD = OD == '' ? parent : [parent, OD].join('.');
}
for (var ModuleName in this.Modules) {

@@ -763,0 +784,0 @@ if (this.Modules.hasOwnProperty(ModuleName)) {

{
"name": "net-snmp",
"version": "3.10.1",
"version": "3.10.2",
"description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc