Skip to content

Commit

Permalink
Merge pull request #19763 from adfoster-r7/fix-flaky-windows-version-…
Browse files Browse the repository at this point in the history
…detection

Fix flaky windows version detection
  • Loading branch information
jheysel-r7 authored Dec 23, 2024
2 parents 66f6cac + a65135e commit a133b58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/msf/core/windows_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ def major_release_name

# Get a Windows OS version string representation for a given major, minor and build number
def self.version_string(major, minor, build, version_module, mapping)
version_module.constants.each do |version_sym|
version = version_module.const_get(version_sym)
sorted_versions = version_module.constants
.map { |version_sym| [version_sym, version_module.const_get(version_sym)] }
.sort_by { |_version_sym, version| version.segments }
sorted_versions.each do |version_sym, version|
segments = version.segments
if segments[0..2] == [major, minor, build]
return mapping[version_sym]
Expand Down

0 comments on commit a133b58

Please sign in to comment.