Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

systeminformation

Package Overview
Dependencies
Maintainers
1
Versions
694
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 5.23.18 to 5.23.19

52

lib/internet.js

@@ -65,48 +65,10 @@ 'use strict';

}
let t = Date.now();
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
let args = ['-I', '--connect-timeout', '5', '-m', '5'];
args.push(urlSanitized);
let cmd = 'curl';
util.execSafe(cmd, args).then((stdout) => {
const lines = stdout.split('\n');
let statusCode = lines[0] && lines[0].indexOf(' ') >= 0 ? parseInt(lines[0].split(' ')[1], 10) : 404;
result.status = statusCode || 404;
result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
result.ms = (result.ok ? Date.now() - t : null);
if (callback) { callback(result); }
resolve(result);
});
}
if (_windows) { // if this is stable, this can be used for all OS types
const http = (urlSanitized.startsWith('https:') ? require('https') : require('http'));
try {
http.get(urlSanitized, (res) => {
const statusCode = res.statusCode;
result.status = statusCode || 404;
result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
if (statusCode !== 200) {
res.resume();
result.ms = (result.ok ? Date.now() - t : null);
if (callback) { callback(result); }
resolve(result);
} else {
res.on('data', () => { });
res.on('end', () => {
result.ms = (result.ok ? Date.now() - t : null);
if (callback) { callback(result); }
resolve(result);
});
}
}).on('error', () => {
if (callback) { callback(result); }
resolve(result);
});
} catch (err) {
if (callback) { callback(result); }
resolve(result);
}
}
util.checkWebsite(urlSanitized).then((res) => {
result.status = res.statusCode;
result.ok = res.statusCode >= 200 && res.statusCode <= 399;;
result.ms = (result.ok ? res.time : null);
if (callback) { callback(result); }
resolve(result);
});
} else {

@@ -113,0 +75,0 @@ if (callback) { callback(result); }

37

lib/util.js

@@ -2486,2 +2486,38 @@ 'use strict';

function checkWebsite(url, timeout = 5000) {
const http = ((url.startsWith('https:') || url.indexOf(':443/') > 0 || url.indexOf(':8443/') > 0) ? require('https') : require('http'));
const t = Date.now();
return new Promise((resolve) => {
http
.get(url, { rejectUnauthorized: false }, function (res) {
res.on('data', () => { });
res.on('end', () => {
resolve({
url,
statusCode: res.statusCode,
message: res.statusMessage,
time: Date.now() - t
});
});
})
.on("error", function (e) {
resolve({
url,
statusCode: 404,
message: e.message,
time: Date.now() - t
});
})
.setTimeout(timeout, () => {
request.close();
resolve({
url,
statusCode: 408,
message: 'Request Timeout',
time: Date.now() - t
});
});
});
};
function noop() { }

@@ -2540,1 +2576,2 @@

exports.getAppleModel = getAppleModel;
exports.checkWebsite = checkWebsite;
{
"name": "systeminformation",
"version": "5.23.18",
"version": "5.23.19",
"description": "Advanced, lightweight system and OS information library",

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

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