Skip to content

Instantly share code, notes, and snippets.

@nmarley
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmarley/4ad3c80ac5fbc5f36a41 to your computer and use it in GitHub Desktop.
Save nmarley/4ad3c80ac5fbc5f36a41 to your computer and use it in GitHub Desktop.
Domain Expiration Checker
#! /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
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