检查阿里云ssl证书到期情况
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-06-10 16:00
# @Author : Anthony.long
# @Site :
# @File : check_ssl_dated.py
# @Software: PyCharm # 查询域名证书到期情况 import re
import time
import subprocess
from datetime import datetime
from io import StringIO def main(domain):
f = StringIO()
start_time = time.strftime("%Y-%m-%d %X", time.localtime()) comm = f"curl -Ivs https://{domain} --connect-timeout 5"
result = subprocess.getstatusoutput(comm)
f.write(result[1]) end_time = time.strftime("%Y-%m-%d %X", time.localtime()) start_date = re.search('(start date:.*?\n)', f.getvalue(), re.S).group().strip().split(': ')[1]
expire_date = re.search('(expire date:.*?\n)', f.getvalue(), re.S).group().strip().split(': ')[1]
subjectAltName_name = re.search('(subjectAltName:.*?\n)', f.getvalue(), re.S).group().strip().split(': ')[1]
issuer = re.search('(issuer:.*?\n)', f.getvalue(), re.S).group().strip().split(': ')[1] # # time 字符串转时间数组
start_date = time.strptime(start_date, "%b %d %H:%M:%S %Y GMT")
start_date_st = time.strftime("%Y-%m-%d %H:%M:%S", start_date)
# # datetime 字符串转时间数组
expire_date = datetime.strptime(expire_date, "%b %d %H:%M:%S %Y GMT")
expire_date_st = datetime.strftime(expire_date, "%Y-%m-%d %H:%M:%S") # # 剩余天数
remaining = (expire_date - datetime.now()).days print('域名:', domain)
print('通用名:', subjectAltName_name)
print('证书开始使用时间:', start_date_st)
print('证书到期时间:', expire_date_st)
print(f'证书剩余可用时间: {remaining}天')
print('颁发机构:', issuer)
print('*' * 30) time.sleep(0.5) if __name__ == "__main__":
with open('domains.txt','r',encoding="utf-8") as file:
# with open('onlineDomains.txt', 'r', encoding="utf-8") as file:
for domain in file:
main(domain.strip())
检查阿里云ssl证书到期情况的更多相关文章
- 阿里云SSL证书到期(续期)图文教程
今天公司项目突然报错 后来查询是SSL证书过期了.友情提示: 证书产品仅支持新签发.不支持续费.证书到期前需在阿里云SSL证书控制台重新购买和申请证书. 登录阿里云控制台,点击产品与服务,在搜索框搜索 ...
- 宝塔面板配置阿里云SSL证书流程
阿里云SSL证书申请过程就不在这里说了 1 先下载阿里云成功申请的SSL证书 解压后 有3个文件 2 找到宝塔面板的 站点设置 找到SSL设置 3 找到其他证书 用文本打开.key文件 复制里面 ...
- tomcat部署安全证书文件(阿里云SSL证书)
1.下载安全证书文件: 这里使用的是阿里云SSL证书(免费一年) 2.把下载的压缩包进行解压 3.将pfx文件拷贝至服务器 4.利用jdk将pfx转jks 5.cmd进入命令行 6.切换至jdk的bi ...
- 阿里云ssl证书过期怎么解决 (免费SSL证书) 三步解决
阿里云ssl证书过期怎么解决(免费SSL证书),三步解决 使用免费的SSL证书网站 https://ohttps.com 1.注册帐号 2.申请证书 3.部署到阿里云 4.注意事项 1.注册帐号 到 ...
- Linux下Nginx配置阿里云 SSL证书实现HTTPS访问
这篇文章主要介绍了nginx配置ssl证书实现https访问的示例 1.服务器系统:Centos 2. 阿里云申请SSL证书 选择“免费版DV SSL”,点击立即购买: 下载证书 列表中找到已签发的证 ...
- 阿里云 SSL 证书 总结
历时2天左右的证书上传部署,终于结束了! 因为公司要开发小程序,小程序部署到开发环境必须支持https证书行. 阿里云目前的证书还是比较多的额,大致分为2类,一类是支持单域名,一类是支持泛域名. 自己 ...
- 初识 阿里云 SSL 证书申请
去你尼玛的大QQ ,一个 SSL 证书,花了我一整天时间,特意在此记载,为后面的小伙伴参考 最近在开发小程序,小程序规定要使用 https 协议,那我能怎么办?去申请啊,傻逼 阿里云的 SSL 证书申 ...
- 阿里云SSL证书tomcat配置
1. SSL证书申请 登录阿里云控制台,查看购买域名中有SSL证书的申请,ssl证书申请中有单域名的申请,配置要申请的域名信息(注意:一个域名下,一次只能添加一个证书,最多申请3个免费证书用于测试), ...
- wdCP v3.3.8apache阿里云ssl证书实现智慧软文http转换https的详细操作教程
先展示一下效果:智慧软文发布系统(https://www.zhihuiruanwen.com) 之前用的是传统的http,发现360浏览器,火狐浏览器,谷歌浏览器均提示不安全的链接,最主要的是第一次打 ...
随机推荐
- java中String,int,Integer,char、double类型转换
java中String,int,Integer,char.double类型转换----https://www.cnblogs.com/kangyu222/p/5866025.html
- 文件处理: read、readline、 readlines()
假设a.txt的内容如下所示: Hello Welcome What is the fuck.. 1. read([size])方法 read([size])方法:从文件当前位置起读取size个字节, ...
- java虚拟机(二)--垃圾收集器与内存分配策略
1.判断对象是否存活的算法: 1.1.引用计数算法:给对象添加一个引用计数器,每当有一个地方引用他时,计数器+1,当引用失效时,计数器-1,任何时刻计数器为0的对象就是不可能再被引用的,但是他很难解决 ...
- Linux 使用pwgen命令创建随机密码
https://blog.csdn.net/fdipzone/article/details/73864598 http://www.netkou.com/?post=155
- $scope的生命周期
model mutation 模型改变 model observation 模型观察 scope destruction scope结束 神奇的scope,一个angular应用只有一个scope,一 ...
- HDU——1267 下沙的沙子有几粒?
下沙的沙子有几粒? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- Spring Framework体系结构简介
说明:以下转自Spring官方文档,用的版本为4.3.11版本. 一.引用官方文档 2.2.1核心集装箱 所述核心容器由以下部分组成spring-core, spring-beans,spring-c ...
- 【Linux命令】--(1)文件文件夹操作命令15条
文件文件夹操作命令++++++++++++++++++++++++++++++++++++++++ 列出进入显示文件夹 ls cd pwd 创建移动删除文件 mkdir rm rmd ...
- VBS调用Windows API函数
Demon's Blog 忘记了,喜欢一个人的感觉 Demon's Blog » 程序设计 » VBS调用Windows API函数 « 用VBS修改Windows用户密码 在VB中创建和使用 ...
- LeetCode 690. Employee Importance (职员的重要值)
You are given a data structure of employee information, which includes the employee's unique id, his ...