added a file for getting calibre ips from shodan

This commit is contained in:
booboy 2019-03-14 00:55:44 -05:00
parent 6ecbfd2cdf
commit 1bc001832b

22
get_calibre_ips.rb Executable file
View file

@ -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