Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # RubyGems client upgrader script
- # Set some basic items to build on
- home_path = Dir.home
- # This is set for user RVM install (modify as needed for system RVM install)
- rvm_path = home_path + "/.rvm"
- rvm_rubies_path = rvm_path + "/rubies/"
- check_paths = [
- rvm_rubies_path, # The locations of RVM Rubies for a user install
- "/usr/" # The location for a system install on Mac
- ]
- check_paths.each do |check_path|
- Dir.entries(check_path).each do |ruby_path|
- gem_path = check_path + ruby_path + "/bin/gem"
- if File.exists?(gem_path)
- puts "Found a RubyGems client binary at #{gem_path}"
- gem_version = `#{gem_path} --version`.chomp
- unless gem_version.empty?
- if gem_version == "2.4.8"
- puts "RubyGems client binary at version #{gem_version} (PATCHED)"
- else
- puts "RubyGems client binary at version #{gem_version} (VULNERABLE)"
- puts "Attempting to upgrade RubyGems client"
- puts `#{gem_path} update --system`
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement