Skip to content

Instantly share code, notes, and snippets.

@starwels
Last active December 17, 2019 18:23
Show Gist options
  • Save starwels/59085ccc0600c0f976bf1798ec8575a9 to your computer and use it in GitHub Desktop.
Save starwels/59085ccc0600c0f976bf1798ec8575a9 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'net/http'
URL = 'bucket_url'
DIGITS_AND_LETTERS = (0..9).to_a.concat(('a'..'z').to_a)
count = 0
DIGITS_AND_LETTERS.repeated_permutation(32) do |num|
begin
%w(extensions_array).each do |file_extension|
response = Net::HTTP.get_response(URI("#{URL}#{num.join}#{file_extension}"))
puts URI("#{URL}#{num.join}#{file_extension}")
if response.code == '200'
download = open("#{URL}#{FILE}#{file_extension}")
IO.copy_stream(download, "./files/#{num.join}#{file_extension}")
count += 1
puts "#{count} hits!!!!!!"
end
end
rescue => e
puts e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment