Project to help use the breadcrumbs that are left by the certificate to build the chain and output it into files.
Project description
Get Certificate Chain 🌐🔐
This Python script retrieves the certificate chain from a website, allowing you to analyze and verify the SSL/TLS certificates of the website. This project is a custom fork of the getCertificateChain project, and the overwhelming majority of credit goes to TheScriptGuy.
Table of Contents
Requirements 📋
- Python 3.10+
- Poetry (optional) - Python Poetry
Installation
PyPi
To install the package from PyPi, simply run the appropriate command.
pip install get-certificate-chain
GitHub
To install from the GitHub repository, follow these steps:
- Clone the repository.
- Change the directory to the cloned repository.
- Install the package using pip.
git clone https://github.com/cdot65/get_certificate_chain.git
cd get_certificate_chain
pip install .
Usage 🚀
Import into script
To use the package in your script, simply import the package and create an instance of the SSLCertificateChainDownloader
object.
To pass arguments into the object, you can use the argparse
library:
- Import the argparse library.
- Import the SSLCertificateChainDownloader object from the package.
- Create an argument parser with a description.
- Add your arguments.
- Parse the arguments.
- Create an instance of the SSLCertificateChainDownloader object.
- Run the downloader object with the parsed arguments.
from get_certificate_chain import SSLCertificateChainDownloader
downloader = SSLCertificateChainDownloader()
# Use the downloader object for your needs
To pass arguments into the object, you can use the argparse
library:
import argparse
from get_certificate_chain import SSLCertificateChainDownloader
# Add your arguments
args = parser.parse_args()
downloader = SSLCertificateChainDownloader()
downloader.run(args)
Or pass the arguments directly into the object:
from get_certificate_chain import SSLCertificateChainDownloader
args = {'domain': 'www.google.com'}
downloader = SSLCertificateChainDownloader()
downloader.run(args)
Command Line CLI
To use the script from the command line, run the following command:
get-certificate-chain --domain www.google.com
Arguments
--domain
: The domain:port pair that the script should connect to. Defaults to www.google.com:443.--rm-ca-files
: Remove the certificate files in the current working directory (*.crt, *.pem).--get-ca-cert-pem
: Get cacert.pem from the curl.se website to help find Root CA.
Contributing
Contributions are welcome! To contribute, please follow these guidelines:
- Write tests for your code using
pytest
. Make sure your tests follow the standards set by the existing tests. - Set up a virtual environment using
Poetry
. You can install Poetry by following the instructions at https://python-poetry.org/docs/#installation.
To set up a new virtual environment for the project, run the appropriate command.
poetry install
To activate the virtual environment, run the appropriate command.
poetry shell
After making your changes and adding tests, ensure that all tests pass by running the appropriate command.
pytest
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for get_certificate_chain-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc4d44b8e000eb6572fbc95569ada0dd65c7f6309ca763e81f467949c4adf826 |
|
MD5 | f43c2d1426f30caa07fd222bbf31afbe |
|
BLAKE2b-256 | 1eef27c82165611c73846a961377ef9385a6e11e33bb8a2568b10e981c276c9a |
Hashes for get_certificate_chain-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c954e47c8dc26168fb7f6c4fd7f45caafb99b323ef1ec1767290d785cd276d98 |
|
MD5 | e6fcf4fa1b4c9e5a8bc9a163b77c1f89 |
|
BLAKE2b-256 | 0dc377705b243698d27f94e299d2ffd6c7670d85ba97a4281a7cb8c6757a8a05 |