Package: get-certificate-chain
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 thegetCertificateChain project, and the overwhelming majority of credit goes toTheScriptGuy.Table of ContentsGet Certificate Chain 🌐🔐Table of ContentsRequirements 📋InstallationPyPiGitHubUsage 🚀Import into scriptCommand Line CLIArgumentsContributingLicenseRequirements 📋Python 3.9+Poetry (optional) -Python PoetryInstallationPyPiTo install the package from PyPi, simply run the appropriate command.pipinstallget-certificate-chainGitHubTo install from the GitHub repository, follow these steps:Clone the repository.Change the directory to the cloned repository.Install the package using pip.gitclonehttps://github.com/cdot65/get_certificate_chain.gitcdget_certificate_chain
pipinstall.Usage 🚀Import into scriptTo use the package in your script, simply import the package and create an instance of theSSLCertificateChainDownloaderobject.To pass arguments into the object, you can use theargparselibrary:Import the argparse library.Import the SSLCertificateChainDownloader object from the package.Create a python dictionary with the "host" key and value of the domain.Create an instance of the SSLCertificateChainDownloader object.Run the downloader object with the parsed arguments.fromget_certificate_chain.downloadimportSSLCertificateChainDownloaderdownloader=SSLCertificateChainDownloader()# Use the downloader object for your needsYou can pass the arguments directly into the object:fromget_certificate_chain.downloadimportSSLCertificateChainDownloaderdownloader=SSLCertificateChainDownloader()downloader.run({'host':'www.google.com'})Or pass you can use theargparselibrary to parse the arguments:importargparsefromget_certificate_chain.downloadimportSSLCertificateChainDownloader# Add your argumentsargs=parser.parse_args()downloader=SSLCertificateChainDownloader()downloader.run(args)You may also specify an output directory when creating an instance of the class:fromget_certificate_chain.downloadimportSSLCertificateChainDownloaderdownloader=SSLCertificateChainDownloader(output_directory="/var/tmp")downloader.run({"host":"www.google.com"})Command Line CLITo use the script from the command line, run the following command:get-certificate-chain--hostwww.google.comget-certificate-chain--rm-ca-filesArguments--host: The host:port pair that the script should connect to. Defaults towww.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 chost.se website to help find Root CA.--log-level: Set the log level. Defaults to INFO.--output-dir: Set the output directory. Defaults to the current working directory.ContributingContributions are welcome! To contribute, please follow these guidelines:Write tests for your code usingpytest. Make sure your tests follow the standards set by the existing tests.Set up a virtual environment usingPoetry. You can install Poetry by following the instructions athttps://python-poetry.org/docs/#installation.To set up a new virtual environment for the project, run the appropriate command.poetryinstallTo activate the virtual environment, run the appropriate command.poetryshellAfter making your changes and adding tests, ensure that all tests pass by running the appropriate command.pytestLicenseThis project is licensed under the MIT License - see theLICENSEfile for details.