Created
January 28, 2023 23:43
-
-
Save rodnt/0e72632af914bcf773722424dc9fac63 to your computer and use it in GitHub Desktop.
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
=begin | |
author: unp4ck | |
usage: | |
$ gem install http | |
$ ruby metricsDumper.rb -u https://example.com/prometheus | |
=end | |
require 'http' | |
require 'optparse' | |
options = {} | |
OptionParser.new do |parser| | |
parser.on('-u', '--url=URL') do |url| | |
options[:url] = url | |
end | |
end.parse! | |
url = options[:url] | |
if url.nil? | |
puts("[!] url need") | |
exit(1) | |
end | |
resp = HTTP.get(url).body.to_s | |
if resp.scan(/remote="[A-Z0-9a-z].*"/).length > 0 | |
puts("[*] Grap REMOTE CONTENT content of #{url}") | |
puts(resp.scan(/remote="[A-Z0-9a-z].*"/)) | |
end | |
if resp.scan(/routeId="[A-Z0-9a-z].*"/).length > 0 | |
puts("[*] Grap REMOTEID content of #{url}") | |
puts(resp.scan(/routeId="[A-Z0-9a-z].*"/)) | |
end | |
if resp.scan(/method="[a-zA-Z]{3,6}"\Sstatus="200"\Suri="\/[a-zA-Z].*"/).length > 0 | |
puts("[*] grep remote urls with 200 OK") | |
puts(resp.scan(/method="[a-zA-Z]{3,6}"\Sstatus="200"\Suri="\/[a-zA-Z].*"/)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment