Sha256: da0ec22f785e49db949724c7fbd49ae8f36531b1b297d3caf4a6802d2375dc10

Contents?: true

Size: 612 Bytes

Versions: 13

Compression:

Stored size: 612 Bytes

Contents

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

module Top10
  @rest_api = Shodanz.api.rest.new
  def self.check(product)
    begin
      @rest_api.host_count(product: product, facets: { country: 10 })["facets"]["country"].collect { |x| x.values }.to_h.invert
    rescue
      puts "Unable to succesffully check the Shodan API."
      exit 1
    end
  end
end

results = Top10.check("apache")

ChartJS.bar do
  file "top_10_apache.html"
  data do
    labels results.keys
    dataset "Countries" do
      color :random
      data results.values
    end 
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shodanz-2.0.8 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.7 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.6 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.5 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.4 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.3 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.2 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.1 examples/top_10_countries_running_apache_chart.rb
shodanz-2.0.0 examples/top_10_countries_running_apache_chart.rb
shodanz-1.0.6 examples/top_10_countries_running_apache_chart.rb
shodanz-1.0.5 examples/top_10_countries_running_apache_chart.rb
shodanz-1.0.4 examples/top_10_countries_running_apache_chart.rb
shodanz-1.0.3 examples/top_10_countries_running_apache_chart.rb