Sha256: 4b4c07d83a9c6561fef32185db77ab60241e95eb15b5624a44f7c8c6b63ee312

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

# crtsh

[![Ruby CI](https://github.com/ninoseki/crtsh/actions/workflows/test.yml/badge.svg)](https://github.com/ninoseki/crtsh/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/ninoseki/crtsh/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/crtsh?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/crtsh/badge)](https://www.codefactor.io/repository/github/ninoseki/crtsh)

[crt.sh](https://crt.sh) API client for Ruby.

## Installation

```bash
gem install crtsh-rb
```

## Usage

```ruby
# 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")
```

```ruby
# 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](https://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crtsh-rb-0.3.1 README.md