Project

crtsh-rb

0.0
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
crt.sh API wrapper for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.8
~> 13.0
~> 2.2
~> 1.2
~> 3.10
~> 6.0
~> 3.12
 Project Readme

crtsh

Ruby CI Coverage Status CodeFactor

crt.sh API client for Ruby.

Installation

gem install crtsh-rb

Usage

# Interact with Web API
require "crtsh"

api = Crtsh::API.new
api.search("crt.sh")
api.search("crt.sh", match: "LIKE")
api.search("crt.sh", exclude: "expired")
api.search("crt.sh", match: "LIKE", exclude: "expired")
# Interact with DB
# Note that you have to install pg manually
# gem install pg
require "crtsh/db"

db = Crtsh::DB.new
sql = """
SELECT digest(certificate.certificate, 'sha256') sha256
FROM certificate_identity, certificate
WHERE certificate.id = certificate_identity.certificate_id
AND x509_notAfter(certificate.certificate) > statement_timestamp()
AND reverse(lower(certificate_identity.name_value)) LIKE reverse(lower($1))
LIMIT 10
"""
# Crtsh::DB#connection returns PG::Connection
result = db.connection.exec_params(sql, ["github.com"])
p result.values

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ninoseki/crtsh.

License

The gem is available as open source under the terms of the MIT License.