Skip to content
Snippets Groups Projects
Commit 8c7c03a6 authored by Erick Hitter's avatar Erick Hitter
Browse files

Initial commit

parents
Branches
No related tags found
No related merge requests found
vendor
{
"name": "ethitter/php-cert-scan",
"description": "Report bulk certificate details in a table.",
"version": "0.1",
"license": "MIT",
"homepage": "https://git.ethitter.com/open-source/php-cert-reporter",
"authors": [
{
"name": "Erick Hitter",
"email": "git-contrib@ethitter.com",
"homepage": "https://ethitter.com",
"role": "Developer"
}
],
"require": {
"wp-cli/php-cli-tools": "^0.11.11"
},
"require-dev": {
"roave/security-advisories": "dev-master"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "cf252676dd41db19372ab2872760342c",
"packages": [
{
"name": "wp-cli/php-cli-tools",
"version": "v0.11.11",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/php-cli-tools.git",
"reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
"reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
"shasum": ""
},
"require": {
"php": ">= 5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"cli": "lib/"
},
"files": [
"lib/cli/cli.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "James Logsdon",
"email": "jlogsdon@php.net",
"role": "Developer"
},
{
"name": "Daniel Bachhuber",
"email": "daniel@handbuilt.co",
"role": "Maintainer"
}
],
"description": "Console utilities for PHP",
"homepage": "http://github.com/wp-cli/php-cli-tools",
"keywords": [
"cli",
"console"
],
"time": "2018-09-04T13:28:00+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
require __DIR__ . '/vendor/autoload.php';
$data = [
[
'Filename',
'CN',
'Expires',
'Days Left',
'SAN',
],
];
foreach ( glob( '*.crt', GLOB_NOSORT ) as $cert ) {
$path = getcwd() . '/' . $cert;
$x509 = openssl_x509_parse( file_get_contents( $path ) );
if ( ! is_array( $x509 ) ) {
printf( 'Failed to parse certificate from `%1$s`%2$s', $path, "\n\n" );
continue;
}
$cert_data = [
0 => $cert,
1 => $x509['subject']['CN'],
2 => date( 'Y-m-d H:i:s T', $x509['validTo_time_t'] ),
3 => (int) round( ( $x509['validTo_time_t'] - time() ) / 86400 ),
4 => '',
];
if ( isset( $x509['extensions']['subjectAltName'] ) ) {
$sans = explode( ',', $x509['extensions']['subjectAltName'] );
foreach ( $sans as $i => $san ) {
$san = explode( ':', $san );
$sans[ $i ] = array_pop( $san );
}
$cert_data[4] = implode( ' ', $sans );
}
$data[] = $cert_data;
}
$table = new \cli\Table( array_shift( $data ), $data );
$table->sort( 2 );
$table->display();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment