Skip to content

Commit 583dab6

Browse files
author
HD Moore
committed
Introduce and use OS matching constants
1 parent eda8a90 commit 583dab6

File tree

63 files changed

+97
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+97
-68
lines changed

lib/msf/core/constants.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ module VmwareVersions
7676
end
7777

7878
module WindowsVersions
79+
NINE5 = "95"
80+
NINE8 = "98"
7981
NT = "NT"
8082
XP = "XP"
8183
TWOK = "2000"
@@ -89,6 +91,33 @@ module WindowsVersions
8991
end
9092

9193
UNKNOWN = "Unknown"
94+
95+
module Match
96+
WINDOWS = /^(?:Microsoft )?Windows/
97+
WINDOWS_95 = /^(?:Microsoft )?Windows 95/
98+
WINDOWS_98 = /^(?:Microsoft )?Windows 98/
99+
WINDOWS_ME = /^(?:Microsoft )?Windows ME/
100+
WINDOWS_NT3 = /^(?:Microsoft )?Windows NT 3/
101+
WINDOWS_NT4 = /^(?:Microsoft )?Windows NT 4/
102+
WINDOWS_2000 = /^(?:Microsoft )?Windows 2000/
103+
WINDOWS_XP = /^(?:Microsoft )?Windows XP/
104+
WINDOWS_2003 = /^(?:Microsoft )?Windows 2003/
105+
WINDOWS_VISTA = /^(?:Microsoft )?Windows Vista/
106+
WINDOWS_2008 = /^(?:Microsoft )?Windows 2008/
107+
WINDOWS_7 = /^(?:Microsoft )?Windows 7/
108+
WINDOWS_2012 = /^(?:Microsoft )?Windows 2012/
109+
WINDOWS_8 = /^(?:Microsoft )?Windows 8/
110+
WINDOWS_81 = /^(?:Microsoft )?Windows 8\.1/
111+
112+
LINUX = /^Linux/i
113+
MAC_OSX = /^(Apple )?Mac OS X/
114+
FREEBSD = /^FreeBSD/
115+
NETBSD = /^NetBSD/
116+
OPENBSD = /^OpenBSD/
117+
VMWARE = /^VMware/
118+
ANDROID = /^(?Google )?Android/
119+
APPLE_IOS = /^(?:Apple )?iOS/
120+
end
92121
end
93122
end
94123

modules/exploits/android/browser/webview_addjavascriptinterface.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Metasploit3 < Msf::Exploit::Remote
1111
include Msf::Exploit::Remote::BrowserAutopwn
1212

1313
autopwn_info({
14-
:os_name => "Android",
14+
:os_name => OperatingSystems::Match::ANDROID,
1515
:arch => ARCH_ARMLE,
1616
:javascript => true,
1717
:rank => ExcellentRanking,
@@ -66,7 +66,7 @@ def initialize(info = {})
6666
'DefaultTarget' => 0,
6767
'BrowserRequirements' => {
6868
:source => 'script',
69-
:os_name => 'Android',
69+
:os_name => OperatingSystems::Match::ANDROID,
7070
:arch => ARCH_ARMLE
7171
}
7272
))

modules/exploits/multi/browser/firefox_escape_retval.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Metasploit3 < Msf::Exploit::Remote
1818
# :ua_name => HttpClients::FF,
1919
# :ua_minver => "3.5",
2020
# :ua_maxver => "3.5",
21-
# :os_name => /^Windows/,
21+
# :os_name => OperatingSystems::Match::WINDOWS,
2222
# :javascript => true,
2323
# :rank => NormalRanking, # reliable memory corruption
2424
# :vuln_test => nil,

modules/exploits/multi/browser/mozilla_compareto.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Metasploit3 < Msf::Exploit::Remote
2020
# :ua_name => HttpClients::FF,
2121
# :ua_minver => "1.0",
2222
# :ua_maxver => "1.7.10",
23-
# :os_name => /^Windows/,
23+
# :os_name => OperatingSystems::Match::WINDOWS,
2424
# :javascript => true,
2525
# :rank => NormalRanking, # reliable memory corruption
2626
# :vuln_test => "if (typeof InstallVersion != 'undefined') { is_vuln = true; }",

modules/exploits/multi/browser/opera_configoverwrite.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Metasploit3 < Msf::Exploit::Remote
1717
autopwn_info({
1818
:ua_name => HttpClients::OPERA,
1919
:ua_maxver => "9.10",
20-
:os_name => [ /^Windows/, /^Mac OS X/, ],
20+
:os_name => [ OperatingSystems::Match::WINDOWS, OperatingSystems::Match::MAC_OSX, ],
2121
:javascript => true,
2222
:rank => ExcellentRanking, # reliable cmd exec, cleans up after itself
2323
:vuln_test => nil,

modules/exploits/osx/browser/mozilla_mchannel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Metasploit3 < Msf::Exploit::Remote
1515
# :ua_name => HttpClients::FF,
1616
# :ua_minver => "3.6.16",
1717
# :ua_maxver => "3.6.16",
18-
# :os_name => 'Mac OS X',
18+
# :os_name => OperatingSystems::Match::MAC_OSX,
1919
# :javascript => true,
2020
# :rank => NormalRanking,
2121
#})

modules/exploits/osx/browser/safari_metadata_archive.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Metasploit3 < Msf::Exploit::Remote
1717
#autopwn_info({
1818
# :ua_name => HttpClients::SAFARI,
1919
# :ua_maxver => '2.0.2',
20-
# :os_name => [ 'Mac OS X' ],
20+
# :os_name => OperatingSystems::Match::MAC_OSX,
2121
# :javascript => false,
2222
# :rank => ExcellentRanking, # reliable cmd execution
2323
# :vuln_test => nil,

modules/exploits/osx/browser/safari_user_assisted_download_launch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def initialize(info = {})
6060
'BrowserRequirements' => {
6161
:source => 'script',
6262
:ua_name => HttpClients::SAFARI,
63-
:os_name => 'Mac OS X',
63+
:os_name => OperatingSystems::Match::MAC_OSX,
6464

6565
# On 10.6.8 (Safari 5.x), a dialog never appears unless the user
6666
# has already manually launched the dropped exe

modules/exploits/windows/browser/adobe_flash_mp4_cprt.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Metasploit3 < Msf::Exploit::Remote
1212
include Msf::Exploit::RopDb
1313
include Msf::Exploit::Remote::BrowserAutopwn
1414
autopwn_info({
15-
:os_name => /^Windows/,
15+
:os_name => OperatingSystems::Match::WINDOWS,
1616
:method => "GetVariable",
1717
:classid => "ShockwaveFlash.ShockwaveFlash",
1818
:rank => NormalRanking, # reliable memory corruption

modules/exploits/windows/browser/adobe_flash_rtmp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Metasploit3 < Msf::Exploit::Remote
1313
include Msf::Exploit::Remote::BrowserAutopwn
1414

1515
autopwn_info({
16-
:os_name => /^Windows/,
16+
:os_name => OperatingSystems::Match::WINDOWS,
1717
:ua_name => HttpClients::IE,
1818
:ua_minver => "6.0",
1919
:ua_maxver => "8.0",

0 commit comments

Comments
 (0)