Skip to content

Instantly share code, notes, and snippets.

@picatz
Last active November 16, 2017 03:21
Show Gist options
  • Save picatz/da5213d2f65848d6925f903af571c5ce to your computer and use it in GitHub Desktop.
Save picatz/da5213d2f65848d6925f903af571c5ce to your computer and use it in GitHub Desktop.
Top 10 Countries Running Apache
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.line do
file "top_10_apache.html"
data do
labels results.keys
dataset "Countries" do
color :random
data results.values
end
end
end
# open top_10_apache.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment