Skip to content

Instantly share code, notes, and snippets.

@picatz
Created May 28, 2019 19:34
Show Gist options
  • Save picatz/3484a69aa251932d9838b884726a9fa8 to your computer and use it in GitHub Desktop.
Save picatz/3484a69aa251932d9838b884726a9fa8 to your computer and use it in GitHub Desktop.
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