GithubHelp home page GithubHelp logo

nleoutsa / dmarc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trailofbits/dmarc

0.0 0.0 0.0 105 KB

Ruby DMARC Parser

Home Page: https://rubygems.org/gems/dmarc

License: MIT License

Ruby 100.00%

dmarc's Introduction

DMARC

Code Climate Build Status Gem Version YARD Docs Test Coverage

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:[email protected]; ruf=mailto:[email protected]; 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
# => [#<DMARC::Uri:0x0055ede60711e0 @uri=#<URI::MailTo mailto:[email protected]>, @size=nil, @unit=nil>]

record.ruf
# => [#<DMARC::Uri:0x0055ede606f138 @uri=#<URI::MailTo mailto:[email protected]>, @size=nil, @unit=nil>]

record.sp
# => :reject

Query the DMARC record for a domain:

record = DMARC::Record.query('twitter.com')
# => #<DMARC::Record:0x0055ede6b808b0 @v=:DMARC1, @adkim=nil, @aspf=nil, @fo=["1"@79], @p=:reject, @pct=nil, @rf=nil, @ri=nil, @rua=[#<DMARC::Uri:0x0055ede6ba1c40 @uri=#<URI::MailTo mailto:[email protected]>, @size=nil, @unit=nil>], @ruf=[#<DMARC::Uri:0x0055ede6b8b760 @uri=#<URI::MailTo mailto:[email protected]>, @size=nil, @unit=nil>], @sp=nil>

Requirements

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's People

Contributors

postmodern avatar dguido avatar ryansch avatar dgalling avatar ahmeij avatar artemdinaburg avatar woodruffw avatar iamazharsajjad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.