Sha256: 165737ce578b1a258e7118af5a38626e5bf9a0a2144c0424f12666cbf0338aa2

Contents?: true

Size: 381 Bytes

Versions: 3

Compression:

Stored size: 381 Bytes

Contents

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

# clean CTRL+C exit
trap "SIGINT" do
  exit 0
end

# streaming API client
streaming_api = Shodanz.api.streaming.new

# every key's value starts at zero
stats = Hash.new(0)

# collect banners 
streaming_api.banners do |banner|
  product = banner['product']
  puts "#{stats[product] += 1} #{product}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shodanz-1.0.6 examples/streaming_banner_product_stats.rb
shodanz-1.0.5 examples/streaming_banner_product_stats.rb
shodanz-1.0.4 examples/streaming_banner_product_stats.rb