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
|
# EICAR canary
|
||||||
EICARCorrupted = ::Msf::Util::EXE.is_eicar_corrupted?
|
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
|
# Mixin meant to be included into all classes that can have instances that
|
||||||
# should be tied to the framework, such as modules.
|
# should be tied to the framework, such as modules.
|
||||||
|
|
|
@ -57,10 +57,10 @@ module Msf::Modules::Namespace
|
||||||
if const_defined?(:RequiredVersions)
|
if const_defined?(:RequiredVersions)
|
||||||
required_versions = const_get(:RequiredVersions)
|
required_versions = const_get(:RequiredVersions)
|
||||||
minimum_core_version = Gem::Version.new(required_versions[0].to_s)
|
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
|
if (minimum_core_version > Metasploit::Framework::Core::GEM_VERSION ||
|
||||||
minimum_api_version > ::Msf::Framework::VersionAPI)
|
minimum_api_version > Metasploit::Framework::API::GEM_VERSION)
|
||||||
raise Msf::Modules::VersionCompatibilityError.new(
|
raise Msf::Modules::VersionCompatibilityError.new(
|
||||||
:module_path => module_path,
|
:module_path => module_path,
|
||||||
:module_reference_name => module_reference_name,
|
:module_reference_name => module_reference_name,
|
||||||
|
|
|
@ -408,7 +408,7 @@ class Core
|
||||||
avdwarn = nil
|
avdwarn = nil
|
||||||
|
|
||||||
banner_trailers = {
|
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",
|
: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",
|
: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",
|
:free_trial => "Free Metasploit Pro trial: http://r-7.co/trymsp",
|
||||||
|
|
|
@ -218,8 +218,8 @@ describe Msf::Modules::Namespace do
|
||||||
2
|
2
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be > Msf::Framework::VersionAPI' do
|
it 'should be > Metasploit::Framework::API::GEM_VERSION' do
|
||||||
minimum_api_version.should > Msf::Framework::VersionAPI
|
minimum_api_version.should > Metasploit::Framework::API::GEM_VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||||
|
@ -248,16 +248,16 @@ describe Msf::Modules::Namespace do
|
||||||
2
|
2
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be > Msf::Framework::VersionAPI' do
|
it 'should be > Metasploit::Framework::API::GEM_VERSION' do
|
||||||
minimum_api_version.should > Msf::Framework::VersionAPI
|
minimum_api_version.should > Metasploit::Framework::API::GEM_VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with minimum API version' do
|
context 'with minimum API version' do
|
||||||
it 'should be <= Msf::Framework::VersionAPI' do
|
it 'should be <= Metasploit::Framework::API::GEM_VERSION' do
|
||||||
minimum_api_version <= Msf::Framework::VersionAPI
|
minimum_api_version <= Metasploit::Framework::API::GEM_VERSION
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
it_should_behave_like 'Msf::Modules::VersionCompatibilityError'
|
||||||
|
|
Loading…
Reference in New Issue