class Poke::Checks::Blacklist::FreeBlacklistCheck

Public Class Methods

new(ip) click to toggle source
Calls superclass method
# File lib/poke/checks/blacklist/free_blacklist_check.rb, line 17
def initialize(ip)
  name = "Blacklist of #{ip} (postmaster free)"
  @ip = ip
  super name
end

Public Instance Methods

run() click to toggle source

Run the check

# File lib/poke/checks/blacklist/free_blacklist_check.rb, line 24
def run
  html = URI.parse("http://postmaster.free.fr/showipstate.pl?ip=#{@ip}").read
  doc = Nokogiri::HTML(html)
  nodes = doc.search("//div[@class='level1']/font")
  message = nodes.at(0).inner_text

  if message =~ /blacklist/
    return :error, message
  end

  return :ok, message
end