Last active
November 16, 2017 03:21
-
-
Save picatz/da5213d2f65848d6925f903af571c5ce to your computer and use it in GitHub Desktop.
Top 10 Countries Running Apache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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