Giter Site home page Giter Site logo

adamamyl / gman Goto Github PK

View Code? Open in Web Editor NEW

This project forked from benbalter/gman

0.0 2.0 0.0 298 KB

A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains).

License: MIT License

Ruby 94.97% Shell 5.03%

gman's Introduction

Gman Gem

Build Status Gem Version

A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains). It does this by leveraging the power of the Public Suffix List, and the associated Ruby Gem.

You could theoretically use regex, but either you'll a bunch of false positives, or your regex will be insanely complicated. gov.uk, may be valid, for example, but gov.fr is not (it's gouv.fr, for what it's worth).

The solution? Use Public Suffix to verify that it's a valid public domain, then maintain a crowd-sourced sub-list of known global government and military domains. It should cover all US and international, government and military domains for both email and website verification.

See a domains that's missing or one that shouldn't be there? We'd love you to contribute.

Installation

Gman is a Ruby gem, so you'll need a little Ruby-fu to get it working. Simply

gem install gman

Or add this to your Gemfile before doing a bundle install:

gem 'gman'

Usage

Verify email addresses

Gman.valid? "[email protected]" #true
Gman.valid? "[email protected]" #false

Verify domain

Gman.valid? "http://foo.bar.gov" #true
Gman.valid? "foo.bar.gov" #true
Gman.valid? "foo.gov" #true
Gman.valid? "foo.biz" #false

Get a domain name from an arbitrary domain string

Gman.get_domain "http://foo.bar.gov" # foo.bar.gov
Gman.get_domain "[email protected]" # bar.gov
Gman.get_domain "foo.bar.gov" # foo.bar.gov
Gman.get_domain "asdf@asdf" # nil (no domain within the string)

Contributing

Contributions welcome! Please see the contribution guidelines for code contributions or for details on how to add, update, or delete government domains.

Credits

Heavily inspired by swot. Thanks @leereilly!

gman's People

Contributors

adamamyl avatar benbalter avatar jasonlally avatar kcmojohn avatar konklone avatar leereilly avatar parkr avatar pborreli avatar pcnmoore avatar smathermather-cm avatar stephenott avatar vdavez avatar

Watchers

 avatar  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.