Created
May 28, 2019 19:34
-
-
Save picatz/3484a69aa251932d9838b884726a9fa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'async' | |
require 'shodanz' | |
client = Shodanz.client.new | |
# Asynchronously stream banner info from shodan and check any | |
# IP addresses against the experimental honeypot scoring service. | |
client.streaming_api.banners do |banner| | |
if ip = banner['ip_str'] | |
Async do | |
score = client.rest_api.honeypot_score(ip).wait | |
puts "#{ip} has a #{score * 100}% chance of being a honeypot" | |
rescue Shodanz::Errors::RateLimited | |
sleep rand | |
retry | |
rescue # any other errors | |
next | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment