added a file for getting calibre ips from shodan
This commit is contained in:
parent
6ecbfd2cdf
commit
1bc001832b
1 changed files with 22 additions and 0 deletions
22
get_calibre_ips.rb
Executable file
22
get_calibre_ips.rb
Executable 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
|
Loading…
Add table
Reference in a new issue