Socket
Socket
Sign inDemoInstall

systeminformation

Package Overview
Dependencies
Maintainers
1
Versions
653
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systeminformation - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

101

lib/index.js

@@ -9,2 +9,4 @@ // ==================================================================================

// ----------------------------------------------------------------------------------
// Contributors: Guillaume Legrain (https://github.com/glegrain)
// ----------------------------------------------------------------------------------
// License: MIT

@@ -23,3 +25,3 @@ // ==================================================================================

// 8. Internet
//
//
// ==================================================================================

@@ -29,8 +31,8 @@ //

// --------------------------------
// At the time of writing, this library is dependent on the "request" module,
// which needs to be installed seperately. I created a npm package.json file,
// At the time of writing, this library is dependent on the "request" module,
// which needs to be installed seperately. I created a npm package.json file,
// to be able to install it easily:
//
// npm install
//
//
// ==================================================================================

@@ -41,5 +43,5 @@ //

// All functions are asynchronous functions. Here a small example how to use them:
//
//
// var sysinfo = require('./sysinfo.js');
//
//
// sysinfo.cpu(function(data) {

@@ -49,3 +51,3 @@ // console.log('CPU-Information:');

// })
//
//
// ==================================================================================

@@ -55,4 +57,4 @@ //

// --------------------------------
// This library is work in progress. It is quite "fresh" - means, there might be a
// lot of inconsoistencies or even bugs. I was only able to test it on some
// This library is work in progress. It is quite "fresh" - means, there might be a
// lot of inconsoistencies or even bugs. I was only able to test it on some
// Debian and Ubuntu distributions as well as OSX (Maveriks).

@@ -167,3 +169,3 @@ //

result.logofile = getLogoFile(result.distro);
}
}
if (line.indexOf('ProductVersion') != -1) result.release = line.split(':')[1].trim();

@@ -271,3 +273,3 @@ })

// --------------------------
// CPU - temperature
// CPU - temperature
// if sensors are installed

@@ -347,7 +349,7 @@

callback(result);
callback(result);
} else {
callback(result);
}
});
});
} else {

@@ -360,7 +362,7 @@ exec("vm_stat | grep 'Pages active'", function(error, stdout, stderr) {

result.buffcache = result.used - result.active;
callback(result);
callback(result);
} else {
callback(result);
}
});
});
}

@@ -394,3 +396,3 @@ }

callback(data)
});
});
}

@@ -478,3 +480,3 @@

result.push({iface : dev, ip4 : ip4, ip6 : ip6})
}
}
callback(result);

@@ -500,3 +502,3 @@ }

var tx = parseInt(lines[2]);
if (tmp_network["iface"]) {

@@ -523,2 +525,36 @@ var ms = Date.now() - tmp_network["iface"].ms;

} else callback(null);
} else {
var cmd = "netstat -ibI " + iface;
exec(cmd, function(error, stdout, stderr) {
if (!error) {
var lines = stdout.toString().split('\n');
// if there is less than 2 lines, no information for this interface was found
if (lines.length > 1) {
// skip header line
// TODO: operstate
// use the second line because it is tied to the NIC instead of the ipv4 or ipv6 address
var stats = lines[1].replace(/ +/g, " ").split(' ');
var rx = parseInt(stats[6]);
var tx = parseInt(stats[9]);
if (tmp_network["iface"]) {
var ms = Date.now() - tmp_network["iface"].ms;
rx_sec = (rx - tmp_network["iface"].rx) / (ms / 1000);
tx_sec = (tx - tmp_network["iface"].tx) / (ms / 1000);
} else {
rx_sec = 0;
tx_sec = 0;
tmp_network["iface"] = {};
}
tmp_network["iface"].rx = rx;
tmp_network["iface"].tx = tx;
tmp_network["iface"].ms = Date.now();
callback({
rx_sec : rx_sec,
tx_sec : tx_sec
});
}
}
});
} else callback(null);

@@ -546,3 +582,3 @@ }

callback(result)
});
});
}

@@ -561,3 +597,3 @@

// --------------------------
// PS - full load
// PS - full load
// since bootup

@@ -595,3 +631,3 @@

// PS - services
// pass a koma separated string with services to check (mysql, apache, postgresql, ...)
// pass a koma separated string with services to check (mysql, apache, postgresql, ...)
// this function gives an array back, if the services are running.

@@ -616,3 +652,3 @@

callback(data)
});
});
}

@@ -654,3 +690,3 @@

}
callback(result);
callback(result);
})

@@ -661,8 +697,8 @@ }

}
});
});
}
// --------------------------
// PS - process load
// get detailed information about a certain process
// PS - process load
// get detailed information about a certain process
// (PID, CPU-Usage %, Mem-Usage %)

@@ -688,6 +724,6 @@

}
}
}
}
callback(result);
});
});
}

@@ -704,10 +740,9 @@

exports.users = function(callback) {
result.users = [];
result = [];
exec("users", function(error, stdout, stderr) {
result = [];
if (!error) {
result.users = stdout.toString().replace(/ +/g, " ").replace(/\n+/g, " ").trim().split(' ').filter(function(e) {return e.trim() !== ''});
result = stdout.toString().replace(/ +/g, " ").replace(/\n+/g, " ").trim().split(' ').filter(function(e) {return e.trim() !== ''});
}
callback(result);
});
});
}

@@ -720,3 +755,3 @@

// --------------------------
// check if external site is available
// check if external site is available

@@ -723,0 +758,0 @@ exports.checksite = function(url, callback) {

{
"name": "systeminformation",
"version": "1.0.5",
"version": "1.0.6",
"description": "Simple system and OS information library",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -97,3 +97,3 @@ # systeminformation

| - operstate | X | | up / down |
| - rx_sec | X | | received bytes / second |
| - rx_sec | X | X | received bytes / second |
| - tx_sec | X | X | transferred bytes per second |

@@ -133,2 +133,3 @@ | si.currentload() | X | X | CPU-Load in % |

| -------------- | -------------- | -------- |
| 1.0.6 | 2015-09-17 | fixed: si.users() |
| 1.0.5 | 2015-09-14 | updated dependencies |

@@ -155,8 +156,12 @@ | 1.0.4 | 2015-07-18 | updated docs |

#### Credits
## Credits
Written by Sebastian Hildebrandt [sebhildebrandt](https://github.com/sebhildebrandt)
#### License [![MIT license][license-img]][license-url]
#### Contributers
Guillaume Legrain [glegrain](https://github.com/glegrain)
## License [![MIT license][license-img]][license-url]
>The [`MIT`][license-url] License (MIT)

@@ -199,2 +204,2 @@ >

[daviddm-url]: https://david-dm.org/sebhildebrandt/systeminformation
[daviddm-img]: https://img.shields.io/david/sebhildebrandt/systeminformation.svg?style=flat-square
[daviddm-img]: https://img.shields.io/david/sebhildebrandt/systeminformation.svg?style=flat-square
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