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.13.2 to 3.14.0

126

lib/mib.js

@@ -352,12 +352,16 @@ var fs = require('fs');

switch (Symbols[i]) {
case '::=': //new OBJECT to define
//if OBJECT IDENTIFIER tag IS NEXT, FIND MARCO TO CALL...
if (Symbols[i + 1].indexOf('{') == 0) {
var r = i - 1;
var found = false;
//Go back and find the MACRO to call
while (!found && r > 0) {
r--;
case '::=': // new OBJECT or SMIv1 TRAP-TYPE to define
// if an object assignment list is next, the next symbol is a '{' for the integer list
const isObjectIdentifierAssignment = Symbols[i + 1].indexOf('{') == 0;
// iff it is a TRAP-TYPE macro (SMIv1), the next symbol is an integer
const isTrapTypeDefinition = Number.isInteger(Number.parseInt(Symbols[i + 1]));
// Object assigment or trap type definition
if ( isObjectIdentifierAssignment || isTrapTypeDefinition ) {
let macroIndex = i - 1;
let found = false;
// Go back and find the index position of the macro
while ( ! found && macroIndex > 0) {
macroIndex--;
for (var m = 0; m < this.MACROS.length; m++) {
if (Symbols[r] == this.MACROS[m]) {
if (Symbols[macroIndex] == this.MACROS[m]) {
found = true;

@@ -368,2 +372,3 @@ break;

}
// Internal MIB node assignment is marked by an 'OBJECT IDENTIFIER' tag before the ::=
if (Symbols[i - 1] == 'OBJECT IDENTIFIER') {

@@ -389,26 +394,21 @@ Object[Symbols[i - 2]] = {};

}
// Leaf MIB node assignments have a macro, as do TRAP-TYPE definitions
} else {
var ObjectName = Symbols[r - 1];
const ObjectName = Symbols[macroIndex - 1];
Object[ObjectName] = {};
Object[ObjectName]['ObjectName'] = ObjectName;
Object[ObjectName]['ModuleName'] = ModuleName;
Object[ObjectName]['MACRO'] = Symbols[r];
//BUILD OBJECT FROM MACRO TYPE NOTATION
var MARCO = this[Symbols[r]];
if (!MARCO) {
//HACK IF MARCO IS NOT FOUND
//MARCO = {};
//return;
}
var c1 = r;
var keychain = [];
Object[ObjectName]['MACRO'] = Symbols[macroIndex];
// Build MACRO object from TYPE NOTATION
const MACRO = this[Symbols[macroIndex]];
let c1 = macroIndex;
const keychain = [];
keychain.push('DESCRIPTION');
var key;
for (var notation in MARCO['TYPE NOTATION']) {
let key;
for (let notation in MACRO['TYPE NOTATION']) {
key = notation;
//if TYPE NOTATION does not have a value
if (MARCO['TYPE NOTATION'][notation] == null) {
//then look up the value from the MACRO Root
key = MARCO[notation]['MACRO'].replace(/"/g, '');
// If TYPE NOTATION does not have a value
if (MACRO['TYPE NOTATION'][notation] == null) {
// Then look up the value from the MACRO Root
key = MACRO[notation]['MACRO'].replace(/"/g, '');
}

@@ -419,11 +419,9 @@ keychain.push(key);

c1++;
key = Symbols[c1]; //Parse TYPE NOTATION. ex: SYNTAX, ACCESS, STATUS, DESCRIPTION.....
key = Symbols[c1]; // Parse TYPE NOTATION. ex: SYNTAX, ACCESS, STATUS, DESCRIPTION.....
//key == 'DESCRIPTION' ? console.log(keychain.indexOf(key), key, Symbols[c1 + 1]) : false;
const regExp = /\(([^)]+)\)/; // in parentheses e.g. "ethernet-csmacd (6)"
var regExp = /\(([^)]+)\)/; //in parentheses ex: "ethernet-csmacd (6)"
if (keychain.indexOf(key) > -1 || key == 'REVISION') {
var val = Symbols[c1 + 1].replace(/"/g, "");
//if value array.
let val = Symbols[c1 + 1].replace(/"/g, "");
// if value array
if (val.indexOf("{") == 0) {

@@ -440,3 +438,3 @@ c1++;

// build value array
val = val.replace("{", "").replace("}", "").split(",");
val = val.replace("{", "").replace("}", "").split(",").map( (v) => v.trim() );
}

@@ -537,28 +535,30 @@ }

}
Object[Symbols[r - 1]]['ObjectName'] = Symbols[r - 1];
Object[Symbols[r - 1]]['ModuleName'] = ModuleName;
Object[Symbols[r - 1]]['OBJECT IDENTIFIER'] = Symbols[i + 1].replace("{", "").replace("}", "").trim().replace(/\s+/, " ");
if (Object[Symbols[r - 1]]['OBJECT IDENTIFIER'] == '0 0') {
Object[Symbols[r - 1]]['OID'] = '0.0';
Object[Symbols[r - 1]]['NameSpace'] = 'null';
} else {
const { oidString, nameString, unresolvedObject } = this.getOidAndNamePaths(Object[Symbols[r - 1]]['OBJECT IDENTIFIER'], Symbols[r - 1], ModuleName);
Object[Symbols[r - 1]]['OID'] = oidString;
Object[Symbols[r - 1]]['NameSpace'] = nameString;
if (unresolvedObject) {
if ( ! unresolvedObjects.includes(unresolvedObject) ) {
unresolvedObjects.push(unresolvedObject);
Object[Symbols[macroIndex - 1]]['ObjectName'] = Symbols[macroIndex - 1];
Object[Symbols[macroIndex - 1]]['ModuleName'] = ModuleName;
if ( isObjectIdentifierAssignment ) {
Object[Symbols[macroIndex - 1]]['OBJECT IDENTIFIER'] = Symbols[i + 1].replace("{", "").replace("}", "").trim().replace(/\s+/, " ");
if (Object[Symbols[macroIndex - 1]]['OBJECT IDENTIFIER'] == '0 0') {
Object[Symbols[macroIndex - 1]]['OID'] = '0.0';
Object[Symbols[macroIndex - 1]]['NameSpace'] = 'null';
} else {
const { oidString, nameString, unresolvedObject } = this.getOidAndNamePaths(Object[Symbols[macroIndex - 1]]['OBJECT IDENTIFIER'], Symbols[macroIndex - 1], ModuleName);
Object[Symbols[macroIndex - 1]]['OID'] = oidString;
Object[Symbols[macroIndex - 1]]['NameSpace'] = nameString;
if (unresolvedObject) {
if ( ! unresolvedObjects.includes(unresolvedObject) ) {
unresolvedObjects.push(unresolvedObject);
}
}
}
} else if ( isTrapTypeDefinition ) {
Object[Symbols[macroIndex - 1]]['VALUE'] = Number.parseInt(Symbols[i + 1]);
}
if ( Object[Symbols[r - 1]]['REVISIONS-DESCRIPTIONS'] &&
Object[Symbols[r - 1]]['REVISIONS-DESCRIPTIONS'].length == 1 &&
Object[Symbols[r - 1]]['REVISIONS-DESCRIPTIONS'][0]['type'] == 'DESCRIPTION' ) {
delete Object[Symbols[r - 1]]['REVISIONS-DESCRIPTIONS'];
if ( Object[Symbols[macroIndex - 1]]['REVISIONS-DESCRIPTIONS'] &&
Object[Symbols[macroIndex - 1]]['REVISIONS-DESCRIPTIONS'].length == 1 &&
Object[Symbols[macroIndex - 1]]['REVISIONS-DESCRIPTIONS'][0]['type'] == 'DESCRIPTION' ) {
delete Object[Symbols[macroIndex - 1]]['REVISIONS-DESCRIPTIONS'];
}
}
// if object assignment list is not next, check prior symbol for processing instructions / macro creation
} else {
//if OBJECT IDENTIFIER tag is NOT NEXT, check prior symbol for processing instructions / MARCO creation.
switch (Symbols[i - 1]) {

@@ -605,6 +605,6 @@ case 'DEFINITIONS':

}
// End INDEX/AUGMENTS workaround
// End INDEX/AUGMENTS/ACCESS workaround
break;
default:
//new object
// New object
Object[Symbols[i - 1]] = {};

@@ -621,8 +621,8 @@ Object[Symbols[i - 1]]['ObjectName'] = Symbols[i - 1];

if (MACROName != '') {
//ADD macros to root for easier processing
//Still need Import feature
// Add macros to root for easier processing
// Still need Import feature
this[MACROName] = Object;
this.MACROS.push(MACROName);
}
//reset Object to Module root;
// Reset Object to Module root;
Object = Module;

@@ -632,4 +632,2 @@ MACROName = '';

case 'IMPORTS':
//console.log(ModuleName, 'IMPORTS');
//i++;
Module['IMPORTS'] = {};

@@ -656,3 +654,5 @@ var tmp = i + 1;

case 'EXPORTS':
//console.log(ModuleName, 'EXPORTS');
// EXPORTS only appears for SMIv1 once: in RFC1155-SMI - where it exports everything
// EXPORTS are forbidden for SMIv2 in RFC2578 section 3.3, as all objects are exported by default
// Therefore, we ignore EXPORTS for both SMIv1 and SMIv2
break;

@@ -665,3 +665,3 @@ default:

}
// attempt OID/namespace reconstruction for unresolved objects, as parsing has finished
// Attempt OID/namespace reconstruction for unresolved objects, as parsing has finished
if (unresolvedObjects.length > 0) {

@@ -668,0 +668,0 @@ for (const unresolved of unresolvedObjects) {

{
"name": "net-snmp",
"version": "3.13.2",
"version": "3.14.0",
"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

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