diff --git a/get_calibre_ips.rb b/get_calibre_ips.rb new file mode 100755 index 0000000..e96b5c5 --- /dev/null +++ b/get_calibre_ips.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby +# get all of the calibre servers +require 'shodan' +require 'pry' + +client = Shodan::Shodan.new(ENV['shodan_api_key']) +search_results = client.search('server: calibre') + +matches = search_results['matches'] +total = search_results['total'] +pages = (0..(total / 100)) + +puts "total number of matches: #{total}" +puts "total number of pages: #{pages}" + +pages.each do |page| + result = client.search("server: calbire", :page => page) + matches = search_results['matches'] + matches.each do |host| + puts host['ip_str'] + host['port'] + end +end