Add search engines support
parent
74ad8e4970
commit
1a3eeaf4cf
|
@ -1,6 +1,22 @@
|
||||||
module ProjectHoneypot
|
module ProjectHoneypot
|
||||||
class Url
|
class Url
|
||||||
attr_reader :ip_address, :last_activity, :score, :offenses
|
SEARCH_ENGINES = %w(
|
||||||
|
Undocumented
|
||||||
|
AltaVista
|
||||||
|
Ask
|
||||||
|
Baidu
|
||||||
|
Excite
|
||||||
|
Google
|
||||||
|
Looksmart
|
||||||
|
Lycos
|
||||||
|
MSN
|
||||||
|
Yahoo
|
||||||
|
Cuil
|
||||||
|
InfoSeek
|
||||||
|
Miscellaneous
|
||||||
|
)
|
||||||
|
|
||||||
|
attr_reader :ip_address, :last_activity, :score, :offenses, :search_engine
|
||||||
def initialize(ip_address, honeypot_response)
|
def initialize(ip_address, honeypot_response)
|
||||||
@ip_address = ip_address
|
@ip_address = ip_address
|
||||||
@safe = honeypot_response.nil?
|
@safe = honeypot_response.nil?
|
||||||
|
@ -19,6 +35,10 @@ module ProjectHoneypot
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search_engine?
|
||||||
|
@offenses.include?(:search_engine)
|
||||||
|
end
|
||||||
|
|
||||||
def comment_spammer?
|
def comment_spammer?
|
||||||
@offenses.include?(:comment_spammer)
|
@offenses.include?(:comment_spammer)
|
||||||
end
|
end
|
||||||
|
@ -40,9 +60,20 @@ module ProjectHoneypot
|
||||||
@offenses = []
|
@offenses = []
|
||||||
else
|
else
|
||||||
hp_array = honeypot_response.split(".")
|
hp_array = honeypot_response.split(".")
|
||||||
@last_activity = hp_array[1].to_i
|
|
||||||
@score = hp_array[2].to_i
|
if hp_array[3].to_i == 0
|
||||||
@offenses = set_offenses(hp_array[3])
|
# search engine
|
||||||
|
@last_activity = nil
|
||||||
|
@score = 0
|
||||||
|
@offenses = [:search_engine]
|
||||||
|
@search_engine = (hp_array[2].to_i < SEARCH_ENGINES.length ?
|
||||||
|
SEARCH_ENGINES[hp_array[2].to_i] :
|
||||||
|
SEARCH_ENGINES[0])
|
||||||
|
else
|
||||||
|
@last_activity = hp_array[1].to_i
|
||||||
|
@score = hp_array[2].to_i
|
||||||
|
@offenses = set_offenses(hp_array[3])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue