Remove Msf::Framework::VersionAPI
MSP-10998 It's compacting of the version parts into a single float doesn't work with APIMinor over 10, so replace with Gem::Version, which compares parts correctly.bug/bundler_fix
parent
22db5aad8a
commit
9096a8a1f5
|
@ -0,0 +1,7 @@
|
|||
module Metasploit
|
||||
module Framework
|
||||
module API
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
module Metasploit
|
||||
module Framework
|
||||
module API
|
||||
# @note This is a like. The API version is not semantically version and it's version has actually never changed
|
||||
# even though API changes have occured. DO NOT base compatibility on this version.
|
||||
module Version
|
||||
MAJOR = 1
|
||||
MINOR = 0
|
||||
PATCH = 0
|
||||
end
|
||||
|
||||
VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::PATCH}"
|
||||
GEM_VERSION = Gem::Version.new(VERSION)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -42,13 +42,6 @@ class Framework
|
|||
# EICAR canary
|
||||
EICARCorrupted = ::Msf::Util::EXE.is_eicar_corrupted?
|
||||
|
||||
# API Version
|
||||
APIMajor = 1
|
||||
APIMinor = 0
|
||||
|
||||
# API Version
|
||||
VersionAPI = APIMajor + (APIMinor / 10.0)
|
||||
|
||||
#
|
||||
# Mixin meant to be included into all classes that can have instances that
|
||||
# should be tied to the framework, such as modules.
|
||||
|
|
|
@ -57,10 +57,10 @@ module Msf::Modules::Namespace
|
|||
if const_defined?(:RequiredVersions)
|
||||
required_versions = const_get(:RequiredVersions)
|
||||
minimum_core_version = Gem::Version.new(required_versions[0].to_s)
|
||||
minimum_api_version = required_versions[1]
|
||||
minimum_api_version = Gem::Version.new(required_versions[1].to_s)
|
||||
|
||||
if (minimum_core_version > Metasploit::Framework::Core::GEM_VERSION or
|
||||
minimum_api_version > ::Msf::Framework::VersionAPI)
|
||||
if (minimum_core_version > Metasploit::Framework::Core::GEM_VERSION ||
|
||||
minimum_api_version > Metasploit::Framework::API::GEM_VERSION)
|
||||
raise Msf::Modules::VersionCompatibilityError.new(
|
||||
:module_path => module_path,
|
||||
:module_reference_name => module_reference_name,
|
||||
|
|
|
@ -408,7 +408,7 @@ class Core
|
|||
avdwarn = nil
|
||||
|
||||
banner_trailers = {
|
||||
:version => "%yelmetasploit v#{Msf::Framework::Version} [core:#{Metasploit::Framework::Core::GEM_VERSION} api:#{Msf::Framework::VersionAPI}]%clr",
|
||||
:version => "%yelmetasploit v#{Msf::Framework::Version} [core:#{Metasploit::Framework::Core::GEM_VERSION} api:#{Metasploit::Framework::API::GEM_VERSION}]%clr",
|
||||
:exp_aux_pos => "#{framework.stats.num_exploits} exploits - #{framework.stats.num_auxiliary} auxiliary - #{framework.stats.num_post} post",
|
||||
:pay_enc_nop => "#{framework.stats.num_payloads} payloads - #{framework.stats.num_encoders} encoders - #{framework.stats.num_nops} nops",
|
||||
:free_trial => "Free Metasploit Pro trial: http://r-7.co/trymsp",
|
||||
|
|
|
@ -218,8 +218,8 @@ describe Msf::Modules::Namespace do
|
|||
2
|
||||
end
|
||||
|
||||
it 'should be > Msf::Framework::VersionAPI' do
|
||||
minimum_api_version.should > Msf::Framework::VersionAPI
|
||||
it 'should be > Metasploit::Framework::API::GEM_VERSION' do
|
||||
minimum_api_version.should > Metasploit::Framework::API::GEM_VERSION
|
||||
end
|
||||
|
||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||
|
@ -248,16 +248,16 @@ describe Msf::Modules::Namespace do
|
|||
2
|
||||
end
|
||||
|
||||
it 'should be > Msf::Framework::VersionAPI' do
|
||||
minimum_api_version.should > Msf::Framework::VersionAPI
|
||||
it 'should be > Metasploit::Framework::API::GEM_VERSION' do
|
||||
minimum_api_version.should > Metasploit::Framework::API::GEM_VERSION
|
||||
end
|
||||
|
||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||
end
|
||||
|
||||
context 'with minimum API version' do
|
||||
it 'should be <= Msf::Framework::VersionAPI' do
|
||||
minimum_api_version <= Msf::Framework::VersionAPI
|
||||
it 'should be <= Metasploit::Framework::API::GEM_VERSION' do
|
||||
minimum_api_version <= Metasploit::Framework::API::GEM_VERSION
|
||||
end
|
||||
|
||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||
|
|
Loading…
Reference in New Issue