Comparing version 1.0.0 to 1.0.1
10
index.js
@@ -1,2 +0,2 @@ | ||
const exec = require('child_process').exec; | ||
const fs = require('fs'); | ||
@@ -7,3 +7,3 @@ exports.get = function () { | ||
// Run the sockstat terminal command | ||
exec('cat /proc/net/sockstat', function (error, stdout, stderr) { | ||
fs.readFile('/proc/net/sockstat', 'utf8', function (error, data) { | ||
// Sockstat command failed? | ||
@@ -13,6 +13,2 @@ if (error) | ||
// Sockstat command returned an error? | ||
if (stderr) | ||
return reject(new Error('Sockstat error: ' + stderr)); | ||
// Define RegEx pattern to extract stats from the sockstat command output (is there a better way to do this?) | ||
@@ -36,3 +32,3 @@ const pattern = /sockets: used ([0-9]+) TCP: inuse ([0-9]+) orphan ([0-9]+) tw ([0-9]+) alloc ([0-9]+) mem ([0-9]+) UDP: inuse ([0-9]+) mem ([0-9]+) UDPLITE: inuse ([0-9]+) RAW: inuse ([0-9]+) FRAG: inuse ([0-9]+) memory ([0-9]+)/; | ||
fragMem | ||
] = pattern.exec(stdout.replace(/\n/g, ' ')) || []; | ||
] = pattern.exec(data.replace(/\n/g, ' ')) || []; | ||
@@ -39,0 +35,0 @@ // Parse failed? |
{ | ||
"name": "sockstat", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A package that parses the /proc/net/sockstat file for socket connectivity statistics.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
0
16028
6
81
1