Inverse api_key and ip_address arguments in lookup method
parent
56166bbb3c
commit
2870baff6e
|
@ -19,15 +19,16 @@ This Gem requires that you have an Http:BL API key from Project Honeypot. You ca
|
||||||
|
|
||||||
== Usage
|
== Usage
|
||||||
|
|
||||||
|
require 'project_honeypot'
|
||||||
|
|
||||||
HTTP:BL lookups through Project Honeypot result in a Url object that gives you the risk score, last activity, and types of offenses the ip address is listed for.
|
HTTP:BL lookups through Project Honeypot result in a Url object that gives you the risk score, last activity, and types of offenses the ip address is listed for.
|
||||||
|
|
||||||
The score is worse the higher it is and the last_activity is in days.
|
The score is worse the higher it is and the last_activity is in days.
|
||||||
|
|
||||||
|
|
||||||
=== Example #1: Suspicious IP Address
|
=== Example #1: Suspicious IP Address
|
||||||
|
|
||||||
Given an api key of "abcdefghijkl"
|
@listing = ProjectHoneypot.lookup("<ip_address>", "<api_key>")
|
||||||
|
|
||||||
@listing = ProjectHoneypot.lookup("abcdefghijkl", "192.168.1.1")
|
|
||||||
@listing.safe?
|
@listing.safe?
|
||||||
# => false
|
# => false
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ Given an api key of "abcdefghijkl"
|
||||||
|
|
||||||
=== Example #2: Safe IP Address
|
=== Example #2: Safe IP Address
|
||||||
|
|
||||||
@listing = ProjectHoneypot.lookup("192.168.1.1")
|
@listing = ProjectHoneypot.lookup("<ip_address>")
|
||||||
@listing.safe?
|
@listing.safe?
|
||||||
# => true
|
# => true
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
require "project_honeypot"
|
|
|
@ -18,12 +18,12 @@ module ProjectHoneypot
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.lookup(api_key_or_url, url=nil)
|
def self.lookup(url, api_key=nil)
|
||||||
if url.nil?
|
api_key ||= ProjectHoneypot.api_key
|
||||||
url = api_key_or_url
|
|
||||||
api_key_or_url = ProjectHoneypot.api_key
|
raise ArgumentError, 'Must specify an API key' unless api_key
|
||||||
end
|
|
||||||
searcher = Base.new(api_key_or_url)
|
searcher = Base.new(api_key)
|
||||||
searcher.lookup(url)
|
searcher.lookup(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue