Pycrtsh API
- class pycrtsh.api.Crtsh
Main Crtsh object
- get(query: str, type: str = 'sha1') Dict[str, Any]
Search for a certificate with the given value of the given type
- Args:
query (str): value of the query, can be either a crtsh id, sha1 or sha256 type (str): type of the quer, can be [‘id’, ‘sha1’, ‘sha256’]
- Returns:
Dictionnary with the details of the certificate information
- Raises:
CrtshInvalidRequestType: if the query type in invalid CrtshCertificateNotFound: if the certificate can’t be found
- psql_query(query: str) List[Any]
PSQL query in crt.sh database
- Args:
query (str): PSQL query
- Returns:
list: a list of tupes from the query
- Raises:
DependenciesNeeded: if psycopg2 isn’t installed
- search(query: str, timeout: int | None = None) List[Dict[str, Any]]
Search crt.sh with the given query. The query can be a domain, sha1 or sha256.
- Args:
query (str): the crt.sh query timeoit (int) : optional timeout (default is None)
- Returns:
list: list of certificates as dictionaries
- subdomains(domain: str) List[str]
Get a list of subdomains for a domain based on existing certificates
- Args:
domain (str): domain name
- Returns:
list: list of subdomains as strings
- Raises:
DependenciesNeeded: if psycopg2 isn’t installed
- exception pycrtsh.api.CrtshCertificateNotFound
Exception raised if a certificate is not found
- exception pycrtsh.api.CrtshInvalidRequestType
This exception is raised if the request is invalid
- exception pycrtsh.api.DependenciesNeeded
Exception raised if dependencies are missing
- exception pycrtsh.api.PycrtshException
Main Pycrtsh exception. Any exception from the library will raise a subclass of this class.