Last active
August 29, 2015 14:21
-
-
Save nmarley/4ad3c80ac5fbc5f36a41 to your computer and use it in GitHub Desktop.
Domain Expiration Checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'whois' | |
require 'date' | |
require 'time' | |
require 'pp' | |
require 'awesome_print' | |
class Chequer | |
def initialize | |
@whois_client = Whois::Client.new | |
end | |
def lookup_domain(domain) | |
record = @whois_client.lookup(domain) | |
record | |
end | |
def expires_on(domain) | |
lookup_domain(domain).expires_on | |
end | |
end | |
c = Chequer.new | |
# one domain on each line, trim whitespace, filter empty lines | |
domain_list = File.read('domains.txt') | |
.split("\n") | |
.grep(/./) | |
.map { |d| d.gsub(/^\s+|\s+$/, '') } | |
domain_list.each do |domain| | |
# whenn should be a 'Time' object | |
whenn = c.expires_on(domain) | |
puts "#{domain} #{whenn}" | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngmarley.com | |
nathanmarley.com | |
maidinnwa.com | |
jasminedragontea.com | |
stateofthecrypto.com | |
marley.io | |
blackcarrot.be |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment