前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何批量下载域名证书文件??

如何批量下载域名证书文件??

原创
作者头像
研究僧
修改2023-03-21 17:03:59
3.7K0
修改2023-03-21 17:03:59
举报
文章被收录于专栏:产品体验优化私房菜课程

背景

以我个人证书为例,购买后服务商会提供注册机构的证书凭证,证书凭证效果如下。

腾讯云域名管理列表(https://console.cloud.tencent.com/domain/all-domain) 如果管理的域名比较多,又希望批量下载证书时就比较麻烦,因为当前产品功能并未提供批量下载功能。所以今天分享一下,如果来批量下载证书凭证列表。

如何批量下载域名证书文件

介绍一下如何通过脚本批量下载证书文件。 首先打开证书下载页,将证书页的cookies复制到文件中。

复制出来,内容结构大致如下:

代码语言:javascript
复制
curl 'https://domain-wss.cloud.tencent.com/domains/api/domain/certificate?domain=djangowang.vip&g_tk=402638928' \
  -H 'authority: domain-wss.cloud.tencent.com' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
  -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8' \
  -H 'cookie: language=zh; qcloud_uid=5*************6; pgv_pvid=407****938; _gcl_au=1.1.1282719501.1677152303; loginType=qq; wedata_region_id=8; cynosdb_dbType=MYSQL; qcmainCSRFToken=By8GDjv3Jn; qcloud_visitId=cd3fd120280e5ba5c4c4d359cc8ba184; wss_xsrf=e27a5273d577f884fe3a4f572792daed%7C1678781105; x_host_key_access_https=9f*******************6Ijg4NTE5NzAifQ%3D%3D%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%24identity_login_id%22%2C%22value%22%3A%228851970%22%7D%2C%22%24device_id%22%3A%22184ae1be7d6794-0d5c6d486911a1-18525635-2073600-184ae1be7d7a71%22%7D; lastLoginType=qq; uin=o8851970; tinyid=144115211697704307; skey=EvaZhjEpWLsMJEaXN8WW-6kgVTRr-aH-kCd4CuzwaJ0_; intl=1; refreshSession=1; regionId=4; saas_synced_session=8851970%7CEvaZhjEpWLsMJEaXN8WW-6kgVTRr-aH-kCd4CuzwaJ0_; appid=1254105469; _gat=1; ownerUin=O100001049378G; systemTimeGap=-758; isQcloudUser=true; nick=wds; ci_session=5b515d************d0763cab' \
  -H 'referer: https://console.cloud.tencent.com/' \
  -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: iframe' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: same-site' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
  --compressed

将以上内容复制到以下脚本中,并命名脚本文件名download_domainname.sh。

代码语言:javascript
复制
#!/bin/bash
# filename:download_domainname.sh
while read line
do
domainName=$line
curl -o $domainName.jpg 'https://domain-wss.cloud.tencent.com/domains/api/domain/certificate?domain='$domainName'&g_tk=402638928' \
  -H 'authority: domain-wss.cloud.tencent.com' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
  -H 'accept-language: zh-CN,zh;q=0.9,en;q=0.8' \
  -H 'cookie: language=zh; qcloud_uid=5a8e776; pgv_pvid=4071011938; _gcl_au=1.1.1282719501.1677152303; loginType=qq; wedata_region_id=8; cynosdb_dbType=MYSQL; qcmainCSRFToken=By8GDjv3Jn; qcloud_visitId=cd3fd12c8ba184; wss_xsrf=e28G; systemTimeGap=-758; isQcloudUser=true; nick=wds; ci_session=5b5ab' \
  -H 'referer: https://console.cloud.tencent.com/' \
  -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: iframe' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: same-site' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
  compressed

done < domainfile

到腾讯云控制台,批量下载证书域名到本地(https://console.cloud.tencent.com/domain/all-domain)。

下载后用Excel打开复制第一列域名到domainfile文件中。

执行一下download_domainname.sh脚本,最终证书就会下载到当前目录中。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景
  • 如何批量下载域名证书文件
相关产品与服务
SSL 证书
腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档