require 'rbconfig'
require 'yaml'
require 'open3'
module Metasploit
module Framework
module Version
def self.get_hash
@@git_hash ||= begin
root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
version_yml = File.join(root, 'version.yml')
hash = ''
if File.exist?(version_yml)
version_info = YAML.load_file(version_yml)
hash = '-' + version_info['build_framework_rev']
else
changed_files = %w[git rev-parse --short HEAD]
begin
output, _stderr, status = ::Open3.capture3(*changed_files, chdir: root)
hash = "-#{output}" if status.success?
rescue => e
elog(e) if defined?(elog)
end
end
hash.strip
end
end
VERSION = "6.4.28"
MAJOR, MINOR, PATCH = VERSION.split('.').map { |x| x.to_i }
PRERELEASE = 'dev'
HASH = get_hash
end
VERSION = "#{Version::VERSION}-#{Version::PRERELEASE}#{Version::HASH}"
GEM_VERSION = "#{Version::VERSION}"
end
end