2012-12-18 16:53:38 +01:00
|
|
|
require 'net/dns'
|
2012-12-21 16:13:03 +01:00
|
|
|
require "project_honeypot/url"
|
|
|
|
require "project_honeypot/base"
|
2013-01-02 15:49:27 +01:00
|
|
|
require "project_honeypot/rack/header"
|
|
|
|
require "project_honeypot/rack/forbidden"
|
2010-10-20 21:32:24 +02:00
|
|
|
|
2010-10-20 21:00:50 +02:00
|
|
|
module ProjectHoneypot
|
2012-12-19 09:31:17 +01:00
|
|
|
class << self
|
2013-01-04 09:59:51 +01:00
|
|
|
attr_accessor :api_key, :score, :last_activity
|
2012-12-19 09:31:17 +01:00
|
|
|
|
|
|
|
def api_key
|
|
|
|
raise "ProjectHoneypot really needs its api_key set to work" unless @api_key
|
|
|
|
@api_key
|
|
|
|
end
|
|
|
|
|
|
|
|
def configure(&block)
|
|
|
|
class_eval(&block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.lookup(api_key_or_url, url=nil)
|
|
|
|
if url.nil?
|
|
|
|
url = api_key_or_url
|
|
|
|
api_key_or_url = ProjectHoneypot.api_key
|
|
|
|
end
|
|
|
|
searcher = Base.new(api_key_or_url)
|
2010-10-20 21:00:50 +02:00
|
|
|
searcher.lookup(url)
|
|
|
|
end
|
|
|
|
end
|