Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/metasploit/framework/version.rb
Views: 11779
require 'rbconfig'1require 'yaml'2require 'open3'34module Metasploit5module Framework6module Version7# Determines the git hash for this source tree8#9# @return [String] the git hash for this source tree10def self.get_hash11@@git_hash ||= begin12root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))13version_yml = File.join(root, 'version.yml')14hash = ''1516if File.exist?(version_yml)17version_info = YAML.load_file(version_yml)18hash = '-' + version_info['build_framework_rev']19else20# Fallback to using Git version detection if version_yml not present21changed_files = %w[git rev-parse --short HEAD]22begin23# stderr may contain Git warnings that we can ignore24output, _stderr, status = ::Open3.capture3(*changed_files, chdir: root)25hash = "-#{output}" if status.success?26rescue => e27elog(e) if defined?(elog)28end29end30hash.strip31end32end3334VERSION = "6.4.37"35MAJOR, MINOR, PATCH = VERSION.split('.').map { |x| x.to_i }36PRERELEASE = 'dev'37HASH = get_hash38end3940VERSION = "#{Version::VERSION}-#{Version::PRERELEASE}#{Version::HASH}"41GEM_VERSION = "#{Version::VERSION}"42end43end444546