crtsh

package module
Version: v0.0.0-...-03808cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 6 Imported by: 0

README

crt.sh Golang Client

This is a tiny and not feature-full http client in golang for retrieving certificate data from the website crt.sh, which is a web interface (Run by Comodo) for the distributed database known as the certificate transparency logs. Please see 'What is Certificate Transparency?' for more information.

Installation

go get -u github.com/JFryy/go-crtsh-api

Usage

Import the package

import (
	"fmt"
	"github.com/JFryy/go-crtsh-api"
)

Use the GetCerts method for a single organization/domain

func main() {
	// Print Issuer and NameValue certificates for a domain and subdomains
	certs := crtsh.GetCerts("google.com")
	for i := range certs {
		fmt.Println(certs[i].IssuerName, certs[i].NameValue)
	}
}

Or use the GetCerts method for multiple organizations/domains

func main() {
    domains := []string{"google.com", "reddit.com"}
	certs := crtsh.GetCerts(domains)
	for i := range certs {
		fmt.Println(certs[i].IssuerName, certs[i].NameValue)
	}
}

The cert struct and json from crt.sh has the following attributes:

IssuerCaID     int
IssuerName     string
NameValue      string
ID             int64
EntryTimestamp string
NotBefore      string
NotAfter       string
Notes

Upstream changes can and will break functionality of this package. Please use at your own risk.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	IssuerCaID     int    `json:"issuer_ca_id"`
	IssuerName     string `json:"issuer_name"`
	NameValue      string `json:"name_value"`
	ID             int64  `json:"id"`
	EntryTimestamp string `json:"entry_timestamp"`
	NotBefore      string `json:"not_before"`
	NotAfter       string `json:"not_after"`
}

Cert struct matching json response of crt.sh api.

func GetCerts

func GetCerts(query interface{}) []Cert

GetCerts by domain name, organization name or certificate fingerprint. Input parameter as 'string' for single query, input as slice for joining multiple queries/responses.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL