https://github.com/trailofbits/dmarc
Ruby DMARC Parser
https://github.com/trailofbits/dmarc
dmarc dns
Last synced: 3 months ago
JSON representation
Ruby DMARC Parser
- Host: GitHub
- URL: https://github.com/trailofbits/dmarc
- Owner: trailofbits
- License: mit
- Created: 2014-01-10T20:44:42.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T21:05:07.000Z (over 2 years ago)
- Last Synced: 2024-05-01T22:03:46.179Z (about 2 years ago)
- Topics: dmarc, dns
- Language: Ruby
- Homepage: https://rubygems.org/gems/dmarc
- Size: 107 KB
- Stars: 25
- Watchers: 42
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.txt
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# DMARC
[](https://github.com/trailofbits/dmarc/actions/workflows/ci.yml)
[](http://badge.fury.io/rb/dmarc)
[](http://rubydoc.info/gems/dmarc)
[DMARC] is a technical specification intended to solve a couple of long-standing
email authentication problems. DMARC policies are described in DMARC "records,"
which are stored as DNS TXT records on a subdomain. This library contains a
parser for DMARC records.
## Example
Parse a DMARC record:
require 'dmarc'
record = DMARC::Record.parse("v=DMARC1; p=reject; rua=mailto:d@rua.agari.com; ruf=mailto:d@ruf.agari.com; fo=1")
record.v
# => :DMARC1
record.adkim
# => :r
record.aspf
# => :r
record.fo
# => ["0"]
record.p
# => :reject
record.pct
# => 100
record.rf
# => :afrf
record.ri
# => 86400
record.rua
# => [#, @size=nil, @unit=nil>]
record.ruf
# => [#, @size=nil, @unit=nil>]
record.sp
# => :reject
Query the DMARC record for a domain:
record = DMARC::Record.query('twitter.com')
# => #, @size=nil, @unit=nil>], @ruf=[#, @size=nil, @unit=nil>], @sp=nil>
## Requirements
* [parslet] ~> 1.5
## Install
$ gem install dmarc
## Testing
To run the RSpec tests:
$ rake spec
To test the parser against the Alexa Top 500:
$ rake spec:gauntlet
## License
See the {file:LICENSE.txt} file.
[DMARC]: https://tools.ietf.org/html/rfc7489
[parslet]: http://kschiess.github.io/parslet/