Socket
Socket
Sign inDemoInstall

ssl-checker

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 2.0.6

44

lib/cmjs/index.js

@@ -13,7 +13,19 @@ "use strict";

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;

@@ -44,7 +56,2 @@ };

return new Promise(function (resolve, reject) {
var isValidHostName = host &&
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/.test(host);
if (!isValidHostName) {
reject(new Error("Invalid host"));
}
if (!checkPort(options.port)) {

@@ -54,5 +61,12 @@ reject(Error("Invalid port"));

try {
var req = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to;
var req_1 = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to, subjectaltname = _a.subjectaltname;
if (!valid_from || !valid_to || !subjectaltname) {
reject(new Error('No certificate'));
return;
}
var validTo = new Date(valid_to);
var validFor = subjectaltname
.replace(/DNS:|IP Address:/g, "")
.split(", ");
resolve({

@@ -63,7 +77,12 @@ daysRemaining: getDaysRemaining(new Date(), validTo),

validFrom: new Date(valid_from).toISOString(),
validTo: validTo.toISOString()
validTo: validTo.toISOString(),
validFor: validFor
});
});
req.on("error", reject);
req.end();
req_1.on("error", reject);
req_1.on("timeout", function () {
req_1.abort();
reject(new Error('Timed Out'));
});
req_1.end();
}

@@ -76,1 +95,2 @@ catch (e) {

exports["default"] = sslChecker;
module.exports = sslChecker;

@@ -34,7 +34,2 @@ var __assign = (this && this.__assign) || function () {

return new Promise(function (resolve, reject) {
var isValidHostName = host &&
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/.test(host);
if (!isValidHostName) {
reject(new Error("Invalid host"));
}
if (!checkPort(options.port)) {

@@ -44,5 +39,12 @@ reject(Error("Invalid port"));

try {
var req = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to;
var req_1 = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to, subjectaltname = _a.subjectaltname;
if (!valid_from || !valid_to || !subjectaltname) {
reject(new Error('No certificate'));
return;
}
var validTo = new Date(valid_to);
var validFor = subjectaltname
.replace(/DNS:|IP Address:/g, "")
.split(", ");
resolve({

@@ -53,7 +55,12 @@ daysRemaining: getDaysRemaining(new Date(), validTo),

validFrom: new Date(valid_from).toISOString(),
validTo: validTo.toISOString()
validTo: validTo.toISOString(),
validFor: validFor
});
});
req.on("error", reject);
req.end();
req_1.on("error", reject);
req_1.on("timeout", function () {
req_1.abort();
reject(new Error('Timed Out'));
});
req_1.end();
}

@@ -66,1 +73,2 @@ catch (e) {

export default sslChecker;
module.exports = sslChecker;

@@ -1,2 +0,1 @@

/// <reference types="node" />
import * as https from "https";

@@ -8,4 +7,5 @@ interface IResolvedValues {

daysRemaining: number;
validFor: string[];
}
declare const sslChecker: (host: string, options?: Partial<https.RequestOptions>) => Promise<IResolvedValues>;
export default sslChecker;

@@ -12,7 +12,19 @@ var __assign = (this && this.__assign) || function () {

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;

@@ -53,7 +65,2 @@ };

return new Promise(function (resolve, reject) {
var isValidHostName = host &&
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/.test(host);
if (!isValidHostName) {
reject(new Error("Invalid host"));
}
if (!checkPort(options.port)) {

@@ -63,5 +70,12 @@ reject(Error("Invalid port"));

try {
var req = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to;
var req_1 = https.request(__assign({ host: host }, options), function (res) {
var _a = res.connection.getPeerCertificate(), valid_from = _a.valid_from, valid_to = _a.valid_to, subjectaltname = _a.subjectaltname;
if (!valid_from || !valid_to || !subjectaltname) {
reject(new Error('No certificate'));
return;
}
var validTo = new Date(valid_to);
var validFor = subjectaltname
.replace(/DNS:|IP Address:/g, "")
.split(", ");
resolve({

@@ -72,7 +86,12 @@ daysRemaining: getDaysRemaining(new Date(), validTo),

validFrom: new Date(valid_from).toISOString(),
validTo: validTo.toISOString()
validTo: validTo.toISOString(),
validFor: validFor
});
});
req.on("error", reject);
req.end();
req_1.on("error", reject);
req_1.on("timeout", function () {
req_1.abort();
reject(new Error('Timed Out'));
});
req_1.end();
}

@@ -85,2 +104,3 @@ catch (e) {

exports["default"] = sslChecker;
module.exports = sslChecker;
});
{
"name": "ssl-checker",
"version": "2.0.5",
"version": "2.0.6",
"description": "ssl-checker",

@@ -41,4 +41,4 @@ "main": "./lib/cmjs/index.js",

"devDependencies": {
"@types/jest": "^25.1.0",
"@types/node": "^13.5.0",
"@types/jest": "^26.0.14",
"@types/node": "^14.11.2",
"codacy-coverage": "^3.4.0",

@@ -48,8 +48,8 @@ "codecov": "^3.5.0",

"jest-extended": "^0.11.2",
"prettier": "^1.18.2",
"pretty-quick": "^2.0.0",
"prettier": "^2.0.4",
"pretty-quick": "^3.0.2",
"ts-jest": "^24.0.2",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.6.3"
"typescript": "^4.0.3"
},

@@ -56,0 +56,0 @@ "files": [

@@ -47,3 +47,4 @@ # Node SSL Checker

"validFrom": "issue date",
"validTo": "expiry date"
"validTo": "expiry date",
"validFor": ["www.example.com", "example.com"]
}

@@ -50,0 +51,0 @@ ```

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc