https://github.com/trailofbits/dkim-query
Ruby DKIM Parser
https://github.com/trailofbits/dkim-query
dkim dns email
Last synced: 6 months ago
JSON representation
Ruby DKIM Parser
- Host: GitHub
- URL: https://github.com/trailofbits/dkim-query
- Owner: trailofbits
- License: mit
- Created: 2014-11-20T22:30:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-09-12T16:40:40.000Z (about 2 years ago)
- Last Synced: 2024-05-01T22:03:45.953Z (over 1 year ago)
- Topics: dkim, dns, email
- Language: Ruby
- Homepage:
- Size: 72.3 KB
- Stars: 18
- Watchers: 38
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.txt
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# dkim-query
[](https://codeclimate.com/github/trailofbits/dkim-query)
[](https://codeclimate.com/github/trailofbits/dkim-query)
[](https://travis-ci.org/trailofbits/dkim-query)The `dkim-query` library searches the [DKIM] records for a host. We assume the
host uses standard dkim 'selectors', and also check if they use their own
'selector'.## Examples
Parse a DKIM record:
require 'dkim/query'
key = DKIM::Query::Key.parse("k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23bzeoULYv4PeleB3gfmJiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+1xtj4RkdV7fVxTn56Lb4udUnwuxK4V5b5PdOKj/+XcwIDAQAB; n=A 1024 bit key")
key.v
# => nilkey.g
# => nilkey.h
# => nilkey.k
# => :rsakey.n
# => "A 1024 bit key"key.p
# => "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23bzeoULYv4PeleB3gfmJiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+1xtj4RkdV7fVxTn56Lb4udUnwuxK4V5b5PdOKj/+XcwIDAQAB"key.s
# => nilkey.t
# => nilQuery all keys for a domain:
domain = DKIM::Query::Domain.query('yahoo.com')
# => ##}>domain['s1024']
# => #domain.each do |key|
# ...
end## Synopsis
Query a domain:
dkim-query google.com
____________________________
DKIM record search for google.com
- using selectors: ["default", "dkim", "google"]
- no DKIM record found for google.com
____________________________Query multiple domains:
dkim-query trailofbits.com facebook.com yahoo.com
____________________________
DKIM record search for trailofbits.com
- using selectors: ["default", "dkim", "google", "trailofbits"]
- found DKIM record for trailofbits.com at trailofbits._domainkey.trailofbits.com:
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwe04g1hSR55ACcRiLAg0MoEiY5BBviJHJHq/d9r6o+F50fa1TrNNulwKXaST+WCEcW6D2KZ+dt9JvgB9ApIEAFCzHRXhawga0GsfDkOllvpXgT95IPcnYrSkM+rJSbaqHh+YI5sV9sKnvzZDVmB7l5gU3yD74aDmjs9wSg8RC5wIDAQAB
____________________________
____________________________
DKIM record search for facebook.com
- using selectors: ["default", "dkim", "google", "facebook"]
- found DKIM record for facebook.com at default._domainkey.facebook.com:
t=y; k=rsa; p=MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhALkZ4wTn2SQ3EW0vVBExi8izmZZnjZH8JIY5Y964jzDORZku43o6ooFq6HLMjBxmcDYOrJFRdcsKDWtI0Be/uLfc/rClXuyEbcENXfadg77HHv35BI85RNy4TKeai3hxoQIDAQAB;
____________________________
____________________________
DKIM record search for yahoo.com
- using selectors: ["default", "dkim", "google", "yahoo"]
- no DKIM record found for yahoo.com
____________________________## Requirements
* [ruby] >= 1.9.1
* [parslet] ~> 1.6## Install
$ gem install dkim-query
## License
See the {file:LICENSE.txt} file.
[DKIM]: https://tools.ietf.org/html/rfc6376
[ruby]: https://www.ruby-lang.org/
[parslet]: http://kschiess.github.io/parslet/