SecurityTrails
SecurityTrails API wrapper for Ruby.
Installation
Add this line to your application's Gemfile:
gem 'securitytrails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install securitytrails
Usage
require "securitytrails"
# When given nothing, it tries to load your API key from ENV["SECURITYTRAILS_API_KEY"]
api = SecurityTrails::API.new
# or you can pass your API key as an argument
api = SecurityTrails::API.new(YOUR_API_KEY)
# General
# https://docs.securitytrails.com/reference#general
api.ping
api.usage
# Domain details
# https://docs.securitytrails.com/v1.0/reference#domains
api.domain.get_by_hostname("github.com")
api.domain.get_subdomains("github.com")
api.domain.get_tags("github.com")
api.domain.get_associated_domains("github.com")
api.domain.get_whois("github.com")
# Domain search
# https://docs.securitytrails.com/v1.0/reference#domain-search
api.domains.search(
filter: {
ipv4: "1.1.1.1"
})
api.domains.stats(
filter: {
ipv4: "1.1.1.1"
}
)
# History
# https://docs.securitytrails.com/v1.0/reference#history
api.history.get_dns_history("github.com", type: "a")
api.history.get_all_dns_history("github.com", type: "a")
api.history.get_whois_history("github.com")
# IPs
# https://docs.securitytrails.com/v1.0/reference#ips
api.ips.explore("8.8.8.8")
api.ips.search("ptr_part = 'ns1'")
api.ips.stats("ptr_part = 'amazon.com'")
# Feeds
# https://docs.securitytrails.com/v1.0/reference#feeds
api.feeds.domains("new")
api.feeds.domains("new", tld: "jp")
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ninoseki/securitytrails.
License
The gem is available as open source under the terms of the MIT License.