Class: Poke::Checks::Blacklist::SpamhausBlacklistCheck
- Inherits:
-
Poke::Check
- Object
- Poke::Check
- Poke::Checks::Blacklist::SpamhausBlacklistCheck
- Defined in:
- lib/poke/checks/blacklist/spamhaus_blacklist_check.rb
Instance Attribute Summary
Attributes inherited from Poke::Check
Instance Method Summary collapse
-
#initialize(ip) ⇒ SpamhausBlacklistCheck
constructor
A new instance of SpamhausBlacklistCheck.
-
#run ⇒ Object
Run the check.
Constructor Details
#initialize(ip) ⇒ SpamhausBlacklistCheck
Returns a new instance of SpamhausBlacklistCheck.
17 18 19 20 21 |
# File 'lib/poke/checks/blacklist/spamhaus_blacklist_check.rb', line 17 def initialize(ip) name = "Blacklist of #{ip} (Spamhaus)" @ip = ip super name end |
Instance Method Details
#run ⇒ Object
Run the check
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/poke/checks/blacklist/spamhaus_blacklist_check.rb', line 24 def run html = URI.parse("http://www.spamhaus.org/query/ip/#{@ip}").read doc = Nokogiri::HTML(html) nodes = doc.search("//span[@class='body']//b/font") spamhaus_nodes = { 0 => "SBL", 1 => "PBL", 2 => "XBL" } global_returncode = :ok = "" spamhaus_nodes.each do |index, spamtype| returncode, = test_node(nodes, index) global_returncode = :error if returncode == :error += "[#{spamtype}] #{} | " end # Find a better way to do this... = .chop.chop return global_returncode, end |