New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-cert-expiration

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-cert-expiration - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

16

index.js
"use strict";
var _ = require('lodash');
var moment = require('moment');
var tls = require('tls');
var url = require('url');
const _ = require('lodash');
const moment = require('moment');
const tls = require('tls');
const url = require('url');
function checkCertExpiration(targetUrl, callback) {
var target = { host: 'unknown', port: 0, valid_to: new Date(0), daysLeft: 0 };
let target = { host: 'unknown', port: 0, valid_to: new Date(0), daysLeft: 0 };

@@ -20,5 +20,5 @@ try {

var sd = tls.connect(target.port, target.host, function () {
target.valid_to = sd.getPeerCertificate().valid_to;
target.daysLeft = moment(new Date(target.valid_to)).diff(new Date(), 'days');
const sd = tls.connect(target.port, target.host, () => {
target.valid_to = new Date(sd.getPeerCertificate().valid_to).toJSON(); // ISO8601
target.daysLeft = moment(target.valid_to, moment.ISO_8601).diff(moment(), 'days');
sd.end();

@@ -25,0 +25,0 @@ callback(null, target);

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

Copyright (c) 2016 Thomas Cort <linuxgeek@gmail.com>
Copyright (c) 2016, 2017 Thomas Cort <linuxgeek@gmail.com>

@@ -3,0 +3,0 @@ Permission to use, copy, modify, and distribute this software for any

{
"name": "check-cert-expiration",
"version": "1.0.0",
"version": "2.0.0",
"description": "query an SSL/TLS server and report its certificate's expiration date",

@@ -31,9 +31,9 @@ "main": "index.js",

"dependencies": {
"async": "^2.0.0-rc.1",
"logformat": "^1.0.2",
"moment": "^2.12.0",
"lodash": "^4.6.1"
"async": "^2.6.0",
"logformat": "^1.0.6",
"moment": "^2.19.3",
"lodash": "^4.17.4"
},
"devDependencies": {
"jshint": "^2.9.1"
"jshint": "^2.9.5"
},

@@ -40,0 +40,0 @@ "jshintConfig": {

@@ -19,4 +19,4 @@ # check-cert-expiration

$ check-cert-expiration tomcort.com github.com
host=tomcort.com port=443 valid_to="Apr 15 13:54:00 2016 GMT" daysLeft=26
host=github.com port=443 valid_to="May 17 12:00:00 2018 GMT" daysLeft=787
host=tomcort.com port=443 valid_to=2018-03-09T10:34:20.000Z daysLeft=89
host=github.com port=443 valid_to=2018-05-17T12:00:00.000Z daysLeft=159

@@ -38,3 +38,3 @@ Error path (return code is `1`):

* `port` - TCP port number of the host checked,
* `valid_to` - JavaScript Date string.
* `valid_to` - ISO8601 timestamp string.
* `daysLeft` - how many days left until the certificate expires.

@@ -41,0 +41,0 @@

Sorry, the diff of this file is not supported yet

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