Sha256: ed6b906a737fa9cf2d562ecc30392641b4c983c0b9d0063158842d1ece742ed1

Contents?: true

Size: 495 Bytes

Versions: 8

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'async'
require 'shodanz'

client = Shodanz.client.new

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 StandardError # any other errors
      next
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shodanz-2.0.8 examples/async_honeypot_detector.rb
shodanz-2.0.7 examples/async_honeypot_detector.rb
shodanz-2.0.6 examples/async_honeypot_detector.rb
shodanz-2.0.5 examples/async_honeypot_detector.rb
shodanz-2.0.4 examples/async_honeypot_detector.rb
shodanz-2.0.3 examples/async_honeypot_detector.rb
shodanz-2.0.2 examples/async_honeypot_detector.rb
shodanz-2.0.1 examples/async_honeypot_detector.rb