2012-04-04 23:07:17 +00:00
// Case matters, see lib/msf/core/constants.rb
// All of these should match up with constants in ::Msf::HttpClients
2014-10-03 23:05:58 +00:00
var clients _opera = "Opera" ;
var clients _ie = "MSIE" ;
var clients _ff = "Firefox" ;
var clients _chrome = "Chrome" ;
var clients _safari = "Safari" ;
2012-04-04 23:07:17 +00:00
// All of these should match up with constants in ::Msf::OperatingSystems
2014-10-03 23:05:58 +00:00
var oses _linux = "Linux" ;
var oses _android = "Android" ;
var oses _windows = "Windows" ;
var oses _mac _osx = "Mac OS X" ;
var oses _apple _ios = "iOS" ;
var oses _freebsd = "FreeBSD" ;
var oses _netbsd = "NetBSD" ;
var oses _openbsd = "OpenBSD" ;
2012-04-04 23:07:17 +00:00
// All of these should match up with the ARCH_* constants
2014-09-20 22:59:36 +00:00
var arch _armle = "armle" ;
var arch _x86 = "x86" ;
var arch _x86 _64 = "x86_64" ;
var arch _ppc = "ppc" ;
var arch _mipsle = "mipsle" ;
2012-04-04 23:07:17 +00:00
2014-09-20 22:59:36 +00:00
var os _detect = { } ;
2012-04-04 23:07:17 +00:00
/ * *
* This can reliably detect browser versions for IE and Firefox even in the
* presence of a spoofed User - Agent . OS detection is more fragile and
* requires truthful navigator . appVersion and navigator . userAgent strings in
* order to be accurate for more than just IE on Windows .
* * /
2014-09-20 22:59:36 +00:00
os _detect . getVersion = function ( ) {
2012-04-04 23:07:17 +00:00
//Default values:
var os _name ;
2014-04-01 15:14:58 +00:00
var os _vendor ;
var os _device ;
2012-04-04 23:07:17 +00:00
var os _flavor ;
var os _sp ;
var os _lang ;
var ua _name ;
var ua _version ;
var arch = "" ;
var useragent = navigator . userAgent ;
// Trust but verify...
var ua _is _lying = false ;
var version = "" ;
2012-05-15 20:55:12 +00:00
var unknown _fingerprint = null ;
2012-04-04 23:07:17 +00:00
2013-07-19 22:18:39 +00:00
var css _is _valid = function ( prop , propCamelCase , css ) {
if ( ! document . createElement ) return false ;
var d = document . createElement ( 'div' ) ;
d . setAttribute ( 'style' , prop + ": " + css + ";" )
return d . style [ propCamelCase ] === css ;
}
2013-10-14 18:41:26 +00:00
var input _type _is _valid = function ( input _type ) {
2013-10-14 19:15:13 +00:00
if ( ! document . createElement ) return false ;
2013-10-14 18:41:26 +00:00
var input = document . createElement ( 'input' ) ;
input . setAttribute ( 'type' , input _type ) ;
return input . type == input _type ;
}
2012-04-04 23:07:17 +00:00
//--
// Client
//--
if ( window . opera ) {
ua _name = clients _opera ;
if ( ! navigator . userAgent . match ( /Opera/ ) ) {
ua _is _lying = true ;
}
// This seems to be completely accurate, e.g. "9.21" is the return
// value of opera.version() when run on Opera 9.21
ua _version = opera . version ( ) ;
if ( ! os _name ) {
// The 'inconspicuous' argument is there to give us a real value on
// Opera 6 where, without it, the return value is supposedly
// 'Hm, were you only as smart as Bjorn Vermo...'
// though I have not verfied this claim.
switch ( opera . buildNumber ( 'inconspicuous' ) ) {
case "344" : // opera-9.0-20060616.1-static-qt.i386-en-344
2012-04-08 17:12:32 +00:00
case "1347" : // Opera 9.80 / Ubuntu 10.10 (Karmic Koala)
2012-04-04 23:07:17 +00:00
case "2091" : // opera-9.52-2091.gcc3-shared-qt3.i386.rpm
case "2444" : // opera-9.60.gcc4-shared-qt3.i386.rpm
2012-04-08 17:12:32 +00:00
case "2474" : // Opera 9.63 / Debian Testing (Lenny)
2012-04-07 00:09:19 +00:00
case "4102" : // Opera 10.00 / Ubuntu 8.04 LTS (Hardy Heron)
2012-04-04 23:07:17 +00:00
case "6386" : // 10.61
os _name = oses _linux ;
break ;
2012-04-07 00:41:14 +00:00
case "1074" : // Opera 11.50 / Windows XP
case "1100" : // Opera 11.52 / Windows XP
2012-04-07 00:09:19 +00:00
case "3445" : // 10.61
case "3516" : // Opera 10.63 / Windows XP
case "7730" : // Opera 8.54 / Windows XP
2012-04-04 23:07:17 +00:00
case "8502" : // "Opera 9 Eng Setup.exe"
case "8679" : // "Opera_9.10_Eng_Setup.exe"
case "8771" : // "Opera_9.20_Eng_Setup.exe"
case "8776" : // "Opera_9.21_Eng_Setup.exe"
case "8801" : // "Opera_9.22_Eng_Setup.exe"
case "10108" : // "Opera_952_10108_en.exe"
case "10467" : // "Opera_962_en_Setup.exe"
2012-04-07 00:09:19 +00:00
case "10476" : // Opera 9.63 / Windows XP
2012-05-15 22:29:17 +00:00
case "WMD-50433" : // Windows Mobile - "Mozilla/5.0 (Windows Mobile; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 10.00"
2012-04-04 23:07:17 +00:00
os _name = oses _windows ;
break ;
2012-04-07 00:09:19 +00:00
case "2480" : // Opera 9.64 / FreeBSD 7.0
os _name = oses _freebsd ;
break ;
2012-04-04 23:07:17 +00:00
case "6386" : // 10.61
os _name = oses _mac _osx ;
break ;
2012-04-09 20:08:35 +00:00
case "1407" :
// In the case of mini versions, the UA is quite a bit
// harder to spoof, so it's correspondingly easier to
// trust. Unfortunately, despite being fairly truthful in
// what OS it's running on, Opera mini seems to lie like a
// rug in regards to the browser version.
//
// iPhone, iOS 5.0.1
// Opera/9.80 (iPhone; Opera Mini/7.1.32694/27.1407; U; en) Presto/2.8.119 Version/11.10.10
// Android 2.3.6, opera mini 7.1
// Opera/9.80 (Android; Opera Mini/7.29530/27.1407; U; en) Presto/2.8.119 Version/11.101.10
if ( navigator . userAgent . indexOf ( "Android" ) ) {
2014-04-01 15:14:58 +00:00
os _name = oses _android ;
2012-04-09 20:08:35 +00:00
} else if ( navigator . userAgent . indexOf ( "iPhone" ) ) {
2014-04-01 15:14:58 +00:00
os _name = oses _apple _ios ;
os _device = "iPhone" ;
2012-04-09 20:08:35 +00:00
}
break ;
2012-04-07 00:09:19 +00:00
// A few are ambiguous, record them here
case "1250" :
2012-04-08 17:12:32 +00:00
// Opera 9.80 / Windows XP
2012-04-07 00:09:19 +00:00
// Opera 11.61 / Windows XP
// Opera 11.61 / Debian 4.0 (Etch)
break ;
2012-05-15 20:55:12 +00:00
default :
unknown _fingerprint = opera . buildNumber ( 'inconspicuous' ) ;
break ;
2012-04-04 23:07:17 +00:00
}
}
2012-06-25 06:03:34 +00:00
} else if ( typeof window . onmousewheel != 'undefined' && ! ( typeof ScriptEngineMajorVersion == 'function' ) ) { // IE 10 now has onmousewheel
2012-04-04 23:07:17 +00:00
// Then this is webkit, could be Safari or Chrome.
// Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
// Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.78 Safari/532.5
// Mozilla/5.0 (Linux; U; Android 2.2; en-au; GT-I9000 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
// Mozilla/5.0 (iPod; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8C148
// Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405
// Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
// Google Chrome has window.google (older versions), window.chromium (older versions), and window.window.chrome (3+)
if ( window . chromium || window . google || window . chrome ) {
ua _name = clients _chrome ;
search = "Chrome" ;
} else {
ua _name = clients _safari ;
search = "Version" ;
}
platform = navigator . platform . toLowerCase ( ) ;
// Just to be a pain, iPod and iPad both leave off "Safari" and
// "Version" in the UA, see example above. Grab the webkit version
// instead. =/
if ( platform . match ( /ipod/ ) ) {
2014-04-01 15:14:58 +00:00
os _name = oses _apple _ios ;
os _device = "iPod" ;
2012-04-04 23:07:17 +00:00
arch = arch _armle ;
search = "AppleWebKit" ;
} else if ( platform . match ( /ipad/ ) ) {
2014-04-01 15:14:58 +00:00
os _name = oses _apple _ios ;
os _device = "iPad" ;
2012-04-04 23:07:17 +00:00
arch = arch _armle ;
search = "AppleWebKit" ;
} else if ( platform . match ( /iphone/ ) ) {
2014-04-01 15:14:58 +00:00
os _name = oses _apple _ios ;
os _device = "iPhone" ;
2012-04-04 23:07:17 +00:00
arch = arch _armle ;
} else if ( platform . match ( /macintel/ ) ) {
os _name = oses _mac _osx ;
arch = arch _x86 ;
} else if ( platform . match ( /linux/ ) ) {
os _name = oses _linux ;
2014-07-06 14:17:44 +00:00
2012-04-04 23:07:17 +00:00
if ( platform . match ( /x86_64/ ) ) {
arch = arch _x86 _64 ;
} else if ( platform . match ( /arm/ ) ) {
arch = arch _armle ;
2014-04-07 14:44:43 +00:00
} else if ( platform . match ( /x86/ ) ) {
arch = arch _x86 ;
} else if ( platform . match ( /mips/ ) ) {
arch = arch _mipsle ;
}
2014-07-06 14:17:44 +00:00
// Android overrides Linux
2014-04-07 14:44:43 +00:00
if ( navigator . userAgent . match ( /android/i ) ) {
2014-07-06 14:17:44 +00:00
os _name = oses _android ;
2012-04-04 23:07:17 +00:00
}
} else if ( platform . match ( /windows/ ) ) {
os _name = oses _windows ;
}
ua _version = this . searchVersion ( search , navigator . userAgent ) ;
if ( ! ua _version || 0 == ua _version . length ) {
ua _is _lying = true ;
}
2014-02-27 16:54:38 +00:00
} else if ( navigator . oscpu && ! document . all && navigator . taintEnabled || 'MozBlobBuilder' in window ) {
2012-04-04 23:07:17 +00:00
// Use taintEnabled to identify FF since other recent browsers
// implement window.getComputedStyle now. For some reason, checking for
// taintEnabled seems to cause IE 6 to stop parsing, so make sure this
// isn't IE first.
2013-07-19 22:18:39 +00:00
// Also check MozBlobBuilder because FF 9.0.1 does not support taintEnabled
2012-04-04 23:07:17 +00:00
// Then this is a Gecko derivative, assume Firefox since that's the
// only one we have sploits for. We may need to revisit this in the
// future. This works for multi/browser/mozilla_compareto against
// Firefox and Mozilla, so it's probably good enough for now.
ua _name = clients _ff ;
2012-05-15 20:55:12 +00:00
// Thanks to developer.mozilla.org "Firefox for developers" series for most
// of these.
2013-07-18 21:35:57 +00:00
// Release changelogs: http://www.mozilla.org/en-US/firefox/releases/
2015-01-21 22:12:17 +00:00
if ( 'closest' in Element . prototype ) {
ua _version = '35.0' ;
} else if ( 'matches' in Element . prototype ) {
ua _version = '34.0' ;
} else if ( 'RadioNodeList' in window ) {
ua _version = '33.0' ;
} else if ( 'copyWithin' in Array . prototype ) {
2014-09-12 03:01:36 +00:00
ua _version = '32.0' ;
} else if ( 'fill' in Array . prototype ) {
ua _version = '31.0' ;
2014-09-12 16:01:08 +00:00
} else if ( css _is _valid ( 'background-blend-mode' , 'backgroundBlendMode' , 'multiply' ) ) {
2014-09-12 03:01:36 +00:00
ua _version = '30.0' ;
} else if ( css _is _valid ( 'box-sizing' , 'boxSizing' , 'border-box' ) ) {
ua _version = '29.0' ;
} else if ( css _is _valid ( 'flex-wrap' , 'flexWrap' , 'nowrap' ) ) {
2014-03-18 16:26:24 +00:00
ua _version = '28.0' ;
} else if ( css _is _valid ( 'cursor' , 'cursor' , 'grab' ) ) {
2014-02-12 21:32:47 +00:00
ua _version = '27.0' ;
} else if ( css _is _valid ( 'image-orientation' ,
2013-12-10 16:47:11 +00:00
'imageOrientation' ,
'0deg' ) ) {
ua _version = '26.0' ;
} else if ( css _is _valid ( 'background-attachment' ,
2013-10-30 17:19:22 +00:00
'backgroundAttachment' ,
'local' ) ) {
ua _version = '25.0' ;
} else if ( 'DeviceStorage' in window && window . DeviceStorage &&
2013-10-14 18:55:54 +00:00
'default' in window . DeviceStorage . prototype ) {
2013-10-14 18:41:26 +00:00
// https://bugzilla.mozilla.org/show_bug.cgi?id=874213
2013-10-30 17:19:22 +00:00
ua _version = '24.0' ;
2013-10-14 18:41:26 +00:00
} else if ( input _type _is _valid ( 'range' ) ) {
2013-10-30 17:19:22 +00:00
ua _version = '23.0' ;
2013-10-14 18:41:26 +00:00
} else if ( 'HTMLTimeElement' in window ) {
2013-10-30 17:19:22 +00:00
ua _version = '22.0' ;
2013-07-18 21:35:57 +00:00
} else if ( 'createElement' in document &&
document . createElement ( 'main' ) &&
document . createElement ( 'main' ) . constructor === window [ 'HTMLElement' ] ) {
2013-10-30 17:19:22 +00:00
ua _version = '21.0' ;
2013-07-18 21:35:57 +00:00
} else if ( 'imul' in Math ) {
2013-10-30 17:19:22 +00:00
ua _version = '20.0' ;
2013-07-19 22:18:39 +00:00
} else if ( css _is _valid ( 'font-size' , 'fontSize' , '23vmax' ) ) {
2013-10-30 17:19:22 +00:00
ua _version = '19.0' ;
2013-07-18 21:35:57 +00:00
} else if ( 'devicePixelRatio' in window ) {
2013-10-30 17:19:22 +00:00
ua _version = '18.0' ;
2013-07-19 22:18:39 +00:00
} else if ( 'createElement' in document &&
document . createElement ( 'iframe' ) &&
2013-07-19 22:27:27 +00:00
'sandbox' in document . createElement ( 'iframe' ) ) {
2013-10-30 17:19:22 +00:00
ua _version = '17.0' ;
2013-07-19 22:18:39 +00:00
} else if ( 'mozApps' in navigator && 'install' in navigator . mozApps ) {
2013-10-30 17:19:22 +00:00
ua _version = '16.0' ;
2014-10-03 23:05:58 +00:00
} else if ( 'HTMLSourceElement' in window &&
2013-07-19 22:18:39 +00:00
HTMLSourceElement . prototype &&
'media' in HTMLSourceElement . prototype ) {
2013-10-30 17:19:22 +00:00
ua _version = '15.0' ;
2013-07-18 21:35:57 +00:00
} else if ( 'mozRequestPointerLock' in document . body ) {
2013-10-30 17:19:22 +00:00
ua _version = '14.0' ;
2013-07-18 21:35:57 +00:00
} else if ( 'Map' in window ) {
2013-10-30 17:19:22 +00:00
ua _version = "13.0" ;
2013-07-18 21:35:57 +00:00
} else if ( 'mozConnection' in navigator ) {
2012-05-15 20:55:12 +00:00
ua _version = "12.0" ;
} else if ( 'mozVibrate' in navigator ) {
ua _version = "11.0" ;
2013-07-19 22:27:27 +00:00
} else if ( css _is _valid ( '-moz-backface-visibility' , 'MozBackfaceVisibility' , 'hidden' ) ) {
2013-07-19 22:18:39 +00:00
ua _version = "10.0" ;
} else if ( 'doNotTrack' in navigator ) {
2012-05-15 20:55:12 +00:00
ua _version = "9.0" ;
} else if ( 'insertAdjacentHTML' in document . body ) {
ua _version = "8.0" ;
} else if ( 'ondeviceorientation' in window && ! ( 'createEntityReference' in document ) ) {
ua _version = "7.0" ;
2012-05-15 22:42:53 +00:00
} else if ( 'MozBlobBuilder' in window ) {
2012-05-15 20:55:12 +00:00
ua _version = "6.0" ;
} else if ( 'isGenerator' in Function ) {
ua _version = "5.0" ;
} else if ( 'isArray' in Array ) {
ua _version = "4.0" ;
} else if ( document . readyState ) {
2012-04-04 23:07:17 +00:00
ua _version = "3.6" ;
} else if ( String . trimRight ) {
ua _version = "3.5" ;
} else if ( document . getElementsByClassName ) {
ua _version = "3" ;
} else if ( window . Iterator ) {
ua _version = "2" ;
} else if ( Array . every ) {
ua _version = "1.5" ;
} else {
ua _version = "1" ;
}
if ( navigator . oscpu != navigator . platform ) {
ua _is _lying = true ;
}
// oscpu is unaffected by changes in the useragent and has values like:
// "Linux i686"
// "Windows NT 6.0"
// haven't tested on 64-bit Windows
version = navigator . oscpu ;
if ( version . match ( /i.86/ ) ) {
arch = arch _x86 ;
}
if ( version . match ( /x86_64/ ) ) {
arch = arch _x86 _64 ;
}
if ( version . match ( /Windows/ ) ) {
os _name = oses _windows ;
2014-04-01 15:14:58 +00:00
// Technically these will mismatch server OS editions, but those are
// rarely used as client systems and typically have the same exploit
// characteristics as the associated client.
2012-04-04 23:07:17 +00:00
switch ( version ) {
2014-04-01 15:14:58 +00:00
case "Windows NT 5.0" : os _name = "Windows 2000" ; break ;
case "Windows NT 5.1" : os _name = "Windows XP" ; break ;
case "Windows NT 5.2" : os _name = "Windows 2003" ; break ;
case "Windows NT 6.0" : os _name = "Windows Vista" ; break ;
case "Windows NT 6.1" : os _name = "Windows 7" ; break ;
case "Windows NT 6.2" : os _name = "Windows 8" ; break ;
case "Windows NT 6.3" : os _name = "Windows 8.1" ; break ;
2012-04-04 23:07:17 +00:00
}
}
if ( version . match ( /Linux/ ) ) {
os _name = oses _linux ;
}
2015-09-18 15:48:24 +00:00
// end navigator.oscpu checks
2015-09-16 20:59:50 +00:00
else if ( typeof ScriptEngineMajorVersion == "function" ) {
2012-04-04 23:07:17 +00:00
// Then this is IE and we can very reliably detect the OS.
// Need to add detection for IE on Mac. Low priority, since we
// don't have any sploits for it yet and it's a very low market
// share.
os _name = oses _windows ;
ua _name = clients _ie ;
2014-04-01 15:14:58 +00:00
version _maj = ScriptEngineMajorVersion ( ) . toString ( ) ;
version _min = ScriptEngineMinorVersion ( ) . toString ( ) ;
version _build = ScriptEngineBuildVersion ( ) . toString ( ) ;
2014-10-03 23:05:58 +00:00
2014-04-01 15:14:58 +00:00
version = version _maj + version _min + version _build ;
2012-04-04 23:07:17 +00:00
//document.write("ScriptEngine: "+version+"<br />");
switch ( version ) {
case "514615" :
// IE 5.00.2920.0000, 2000 Advanced Server SP0 English
ua _version = "5.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 2000" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
case "515907" :
2014-04-01 15:14:58 +00:00
os _name = "Windows 2000" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP3" ; //or SP2: oCC.getComponentVersion('{22d6f312-b0f6-11d0-94ab-0080c74c7e95}', 'componentid') => 6,4,9,1109
break ;
case "518513" :
2014-04-01 15:14:58 +00:00
os _name = "Windows 2000" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP4" ;
break ;
case "566626" :
// IE 6.0.2600.0000, XP SP0 English
// IE 6.0.2800.1106, XP SP1 English
ua _version = "6.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
case "568515" :
// IE 6.0.3790.0, 2003 Standard SP0 English
ua _version = "6.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 2003" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
case "568820" :
// IE 6.0.2900.2180, xp sp2 english
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP2" ;
break ;
case "568827" :
2014-04-01 15:14:58 +00:00
os _name = "Windows 2003" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP1" ;
break ;
case "568831" : //XP SP2 -OR- 2K SP4
2014-04-01 15:14:58 +00:00
if ( os _name == "2000" ) {
2012-04-04 23:07:17 +00:00
os _sp = "SP4" ;
}
else {
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP2" ;
}
break ;
case "568832" :
2014-04-01 15:14:58 +00:00
os _name = "Windows 2003" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP2" ;
break ;
case "568837" :
// IE 6.0.2900.2180, XP Professional SP2 Korean
ua _version = "6.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP2" ;
break ;
case "5716599" :
2013-07-17 20:46:54 +00:00
// IE 7.0.5730.13, XP Professional SP3 English
2012-04-04 23:07:17 +00:00
// IE 6.0.2900.5512, XP Professional SP3 English
// IE 6.0.2900.5512, XP Professional SP3 Spanish
2013-07-17 20:46:54 +00:00
//
// Since this scriptengine applies to more than one major version of
// IE, rely on the object detection below to determine ua_version.
//ua_version = "6.0";
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP3" ;
break ;
case "575730" :
// IE 7.0.5730.13, Server 2003 Standard SP2 English
// IE 7.0.5730.13, Server 2003 Standard SP1 English
// IE 7.0.5730.13, XP Professional SP2 English
// Rely on the user agent matching above to determine the OS.
// This will incorrectly identify 2k3 SP1 as SP2
ua _version = "7.0" ;
os _sp = "SP2" ;
break ;
case "5718066" :
// IE 7.0.5730.13, XP Professional SP3 English
ua _version = "7.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP3" ;
break ;
2012-04-07 00:09:19 +00:00
case "5722589" :
2013-04-12 03:29:02 +00:00
// IE 7.0.5730.13, XP Professional SP3 English
2012-04-07 00:09:19 +00:00
ua _version = "7.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2013-04-12 03:29:02 +00:00
os _sp = "SP3" ;
2012-04-07 00:09:19 +00:00
break ;
2012-04-04 23:07:17 +00:00
case "576000" :
// IE 7.0.6000.16386, Vista Ultimate SP0 English
ua _version = "7.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows Vista" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
case "580" :
// IE 8.0.7100.0, Windows 7 English
// IE 8.0.7100.0, Windows 7 64-bit English
case "5816385" :
// IE 8.0.7600.16385, Windows 7 English
case "5816475" :
case "5816762" :
// IE 8.0.7600.16385, Windows 7 English
ua _version = "8.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
2013-04-12 03:29:02 +00:00
case "5817514" :
// IE 8.0.7600.17514, Windows 7 SP1 English
ua _version = "8.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2013-04-12 03:29:02 +00:00
os _sp = "SP1" ;
break ;
case "5818702" :
// IE 8.0.6001.18702, XP Professional SP3 English
case "5822960" :
// IE 8.0.6001.18702, XP Professional SP3 Greek
ua _version = "8.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows XP" ;
2013-04-12 03:29:02 +00:00
os _sp = "SP3" ;
break ;
2012-04-04 23:07:17 +00:00
case "9016406" :
// IE 9.0.7930.16406, Windows 7 64-bit
ua _version = "9.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP0" ;
break ;
case "9016441" :
// IE 9.0.8112.16421, Windows 7 32-bit English
ua _version = "9.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2012-04-04 23:07:17 +00:00
os _sp = "SP1" ;
break ;
2012-05-15 20:55:12 +00:00
case "9016443" :
// IE 9.0.8112.16421, Windows 7 Polish
// Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
ua _version = "9.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2012-05-15 20:55:12 +00:00
os _sp = "SP1" ;
break ;
2012-06-25 06:03:34 +00:00
case "9016446" :
// IE 9.0.8112.16421, Windows 7 English (Update Versions: 9.0.7 (KB2699988)
// Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MASA; InfoPath.3; MS-RTC LM 8; BRI/2)Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MASA; InfoPath.3; MS-RTC LM 8; BRI/2)
2013-04-12 03:29:02 +00:00
ua _version = "9.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2013-04-12 03:29:02 +00:00
os _sp = "SP1" ;
break ;
case "9016464" :
// browsershots.org, MSIE 7.0 / Windows 2008 R2
2014-05-19 18:04:36 +00:00
os _name = "Windows 2008 R2" ;
2012-06-25 06:03:34 +00:00
ua _version = "9.0" ;
2013-04-12 03:29:02 +00:00
break ;
case "9016470" :
// IE 9.0.8112.16421 / Windows 7 SP1
ua _version = "9.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2012-06-25 06:03:34 +00:00
os _sp = "SP1" ;
break ;
2014-03-20 02:54:36 +00:00
case "9016502" :
// IE 9.0.8112.16502 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
case "9016506" :
// IE 9.0.8112.16506 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
case "9016514" :
// IE 9.0.8112.16514 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
case "9016520" :
// IE 9.0.8112.16520 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
case "9016526" :
// IE 9.0.8112.16526 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
case "9016533" :
// IE 9.0.8112.16533 / Windows 7 SP1
ua _version = "9.0" ;
2014-05-19 18:04:36 +00:00
os _name = "Windows 7" ;
2014-03-20 02:54:36 +00:00
os _sp = "SP1" ;
break ;
2013-11-06 17:41:36 +00:00
case "10016720" :
// IE 10.0.9200.16721 / Windows 7 SP1
ua _version = "10.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2013-11-06 17:41:36 +00:00
os _sp = "SP1" ;
break ;
2014-02-27 17:01:03 +00:00
case "11016428" :
// IE 11.0.9600.16428 / Windows 7 SP1
ua _version = "11.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 7" ;
2014-02-27 17:01:03 +00:00
os _sp = "SP1" ;
break ;
case "10016384" :
// IE 10.0.9200.16384 / Windows 8 x86
ua _version = "10.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 8" ;
2014-02-27 17:01:03 +00:00
os _sp = "SP0" ;
break ;
2014-05-19 18:04:36 +00:00
case "11016426" :
// IE 11.0.9600.16476 / KB2898785 (Technically: 11.0.2) Windows 8.1 x86 English
ua _version = "11.0" ;
os _name = "Windows 8.1" ;
2014-10-03 23:05:58 +00:00
break ;
2012-06-25 05:41:45 +00:00
case "1000" :
2012-06-25 05:36:04 +00:00
// IE 10.0.8400.0 (Pre-release + KB2702844), Windows 8 x86 English Pre-release
ua _version = "10.0" ;
2014-04-01 15:14:58 +00:00
os _name = "Windows 8" ;
2012-06-25 05:36:04 +00:00
os _sp = "SP0" ;
break ;
2015-07-01 23:06:25 +00:00
case "1100" :
// IE 11.0.10011.0 Windows 10.0 (Build 10074) English - insider preview
ua _version = "11.0" ;
os _name = "Windows 10" ;
os _sp = "SP0" ;
break ;
2012-05-15 20:55:12 +00:00
default :
unknown _fingerprint = version ;
break ;
2012-04-04 23:07:17 +00:00
}
if ( ! ua _version ) {
// The ScriptEngine functions failed us, try some object detection
if ( document . documentElement && ( typeof document . documentElement . style . maxHeight ) != "undefined" ) {
2014-04-02 07:21:16 +00:00
// IE 11 detection, see: http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.85).aspx
2014-03-27 18:31:15 +00:00
try {
2014-04-02 07:21:16 +00:00
if ( document . _ _proto _ _ != undefined ) { ua _version = "11.0" ; }
} catch ( e ) { }
// IE 10 detection using nodeName
if ( ! ua _version ) {
try {
var badNode = document . createElement && document . createElement ( "badname" ) ;
if ( badNode && badNode . nodeName === "BADNAME" ) { ua _version = "10.0" ; }
} catch ( e ) { }
}
2014-03-27 05:15:36 +00:00
// IE 9 detection based on a "Object doesn't support property or method" error
if ( ! ua _version ) {
try {
document . BADNAME ( ) ;
} catch ( e ) {
if ( e . message . indexOf ( "BADNAME" ) > 0 ) {
ua _version = "9.0" ;
}
}
}
2012-04-04 23:07:17 +00:00
// IE8 detection straight from IEBlog. Thank you Microsoft.
2014-03-27 05:15:36 +00:00
if ( ! ua _version ) {
2014-03-27 20:01:03 +00:00
try {
ua _version = "8.0" ;
document . documentElement . style . display = "table-cell" ;
} catch ( e ) {
// This executes in IE7,
// but not IE8, regardless of mode
ua _version = "7.0" ;
2014-03-27 05:15:36 +00:00
}
2012-04-04 23:07:17 +00:00
}
} else if ( document . compatMode ) {
ua _version = "6.0" ;
} else if ( window . createPopup ) {
ua _version = "5.5" ;
} else if ( window . attachEvent ) {
ua _version = "5.0" ;
} else {
ua _version = "4.0" ;
}
switch ( navigator . appMinorVersion ) {
case ";SP2;" :
2015-06-18 23:51:16 +00:00
os _sp = "SP2" ;
2012-04-04 23:07:17 +00:00
break ;
}
}
}
if ( ! os _name && navigator . platform == "Win32" ) { os _name = oses _windows ; }
//--
2014-04-01 15:14:58 +00:00
// Figure out the type of Windows
2012-04-04 23:07:17 +00:00
//--
if ( ! ua _is _lying ) {
version = useragent . toLowerCase ( ) ;
} else if ( navigator . oscpu ) {
// Then this is Gecko and we can get at least os_name without the
// useragent
version = navigator . oscpu . toLowerCase ( ) ;
} else {
// All we have left is the useragent and we know it's lying, so don't bother
version = " " ;
}
if ( ! os _name || 0 == os _name . length ) {
if ( version . indexOf ( "windows" ) != - 1 ) { os _name = oses _windows ; }
else if ( version . indexOf ( "mac" ) != - 1 ) { os _name = oses _mac _osx ; }
else if ( version . indexOf ( "linux" ) != - 1 ) { os _name = oses _linux ; }
}
2014-04-01 15:14:58 +00:00
if ( os _name == oses _windows ) {
if ( version . indexOf ( "windows 95" ) != - 1 ) { os _name = "Windows 95" ; }
else if ( version . indexOf ( "windows nt 4" ) != - 1 ) { os _name = "Windows NT" ; }
else if ( version . indexOf ( "win 9x 4.9" ) != - 1 ) { os _name = "Windows ME" ; }
else if ( version . indexOf ( "windows 98" ) != - 1 ) { os _name = "Windows 98" ; }
else if ( version . indexOf ( "windows nt 5.0" ) != - 1 ) { os _name = "Windows 2000" ; }
else if ( version . indexOf ( "windows nt 5.1" ) != - 1 ) { os _name = "Windows XP" ; }
else if ( version . indexOf ( "windows nt 5.2" ) != - 1 ) { os _name = "Windows 2003" ; }
else if ( version . indexOf ( "windows nt 6.0" ) != - 1 ) { os _name = "Windows Vista" ; }
else if ( version . indexOf ( "windows nt 6.1" ) != - 1 ) { os _name = "Windows 7" ; }
else if ( version . indexOf ( "windows nt 6.2" ) != - 1 ) { os _name = "Windows 8" ; }
else if ( version . indexOf ( "windows nt 6.3" ) != - 1 ) { os _name = "Windows 8.1" ; }
2012-04-04 23:07:17 +00:00
}
2014-04-01 15:14:58 +00:00
if ( os _name == oses _linux && ( ! os _vendor || 0 == os _vendor . length ) ) {
if ( version . indexOf ( "gentoo" ) != - 1 ) { os _vendor = "Gentoo" ; }
else if ( version . indexOf ( "ubuntu" ) != - 1 ) { os _vendor = "Ubuntu" ; }
else if ( version . indexOf ( "debian" ) != - 1 ) { os _vendor = "Debian" ; }
else if ( version . indexOf ( "rhel" ) != - 1 ) { os _vendor = "RHEL" ; }
else if ( version . indexOf ( "red hat" ) != - 1 ) { os _vendor = "RHEL" ; }
else if ( version . indexOf ( "centos" ) != - 1 ) { os _vendor = "CentOS" ; }
else if ( version . indexOf ( "fedora" ) != - 1 ) { os _vendor = "Fedora" ; }
else if ( version . indexOf ( "android" ) != - 1 ) { os _vendor = "Android" ; }
2012-04-04 23:07:17 +00:00
}
//--
// Language
//--
if ( navigator . systemLanguage ) {
// ie
os _lang = navigator . systemLanguage ;
} else if ( navigator . language ) {
// gecko derivatives, safari, opera
os _lang = navigator . language ;
} else {
// some other browser and we don't know how to get the language, so
// just guess english
os _lang = "en" ;
}
//--
// Architecture
//--
if ( typeof ( navigator . cpuClass ) != 'undefined' ) {
// Then this is IE or Opera9+ and we can grab the arch directly
switch ( navigator . cpuClass ) {
case "x86" :
arch = arch _x86 ;
break ;
case "x64" :
arch = arch _x86 _64 ;
break ;
}
}
if ( ! arch || 0 == arch . length ) {
// We don't have the handy-dandy navagator.cpuClass, so infer from
// platform
version = navigator . platform ;
//document.write(version + "\\n");
// IE 8 does a bit of wacky user-agent switching for "Compatibility View";
// 64-bit client on Windows 7, 64-bit:
// Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)
// 32-bit client on Windows 7, 64-bit:
// Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)
// 32-bit client on Vista, 32-bit, "Compatibility View":
// Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)
//
// Report 32-bit client on 64-bit OS as being 32 because exploits will
// need to know the bittedness of the process, not the OS.
if ( ( "Win32" == version ) || ( version . match ( /i.86/ ) ) ) {
arch = arch _x86 ;
} else if ( - 1 != version . indexOf ( 'x64' ) || ( - 1 != version . indexOf ( 'x86_64' ) ) ) {
arch = arch _x86 _64 ;
} else if ( - 1 != version . indexOf ( 'PPC' ) ) {
arch = arch _ppc ;
}
}
2012-04-09 20:08:35 +00:00
this . ua _is _lying = ua _is _lying ;
this . os _name = os _name ;
2014-04-01 15:14:58 +00:00
this . os _vendor = os _vendor ;
2012-04-09 20:08:35 +00:00
this . os _flavor = os _flavor ;
2014-04-01 15:14:58 +00:00
this . os _device = os _device ;
2012-04-09 20:08:35 +00:00
this . os _sp = os _sp ;
this . os _lang = os _lang ;
this . arch = arch ;
this . ua _name = ua _name ;
this . ua _version = ua _version ;
this . ua _version = ua _version ;
2014-04-01 15:14:58 +00:00
return { os _name : os _name , os _vendor : os _vendor , os _flavor : os _flavor , os _device : os _device , os _sp : os _sp , os _lang : os _lang , arch : arch , ua _name : ua _name , ua _version : ua _version } ;
2012-04-09 20:08:35 +00:00
} ; // function getVersion
2012-04-04 23:07:17 +00:00
2014-09-20 22:59:36 +00:00
os _detect . searchVersion = function ( needle , haystack ) {
2012-04-04 23:07:17 +00:00
var index = haystack . indexOf ( needle ) ;
var found _version ;
if ( index == - 1 ) { return ; }
found _version = haystack . substring ( index + needle . length + 1 ) ;
if ( found _version . indexOf ( ' ' ) != - 1 ) {
// Strip off any junk at the end such as a CLR declaration
found _version = found _version . substring ( 0 , found _version . indexOf ( ' ' ) ) ;
}
return found _version ;
2012-04-09 20:08:35 +00:00
} ;
2012-04-04 23:07:17 +00:00
/ *
* Return - 1 if a < b , 0 if a == b , 1 if a > b
* /
2014-09-20 22:59:36 +00:00
ua _ver _cmp = function ( ver _a , ver _b ) {
2012-04-04 23:07:17 +00:00
// shortcut the easy case
if ( ver _a == ver _b ) {
return 0 ;
}
a = ver _a . split ( "." ) ;
b = ver _b . split ( "." ) ;
for ( var i = 0 ; i < Math . max ( a . length , b . length ) ; i ++ ) {
// 3.0 == 3
if ( ! b [ i ] ) { b [ i ] = "0" ; }
if ( ! a [ i ] ) { a [ i ] = "0" ; }
if ( a [ i ] == b [ i ] ) { continue ; }
a _int = parseInt ( a [ i ] ) ;
b _int = parseInt ( b [ i ] ) ;
a _rest = a [ i ] . substr ( a _int . toString ( ) . length ) ;
b _rest = b [ i ] . substr ( b _int . toString ( ) . length ) ;
if ( a _int < b _int ) {
return - 1 ;
} else if ( a _int > b _int ) {
return 1 ;
} else { // ==
// Then we need to deal with the stuff after the ints, e.g.:
// "b4pre"
if ( a _rest == "b" && b _rest . length == 0 ) {
return - 1 ;
}
if ( b _rest == "b" && a _rest . length == 0 ) {
return 1 ;
}
// Just give up and try a lexicographical comparison
if ( a _rest < b _rest ) {
return - 1 ;
} else if ( a _rest > b _rest ) {
return 1 ;
}
}
}
// If we get here, they must be equal
return 0 ;
2012-04-09 20:08:35 +00:00
} ;
2012-04-04 23:07:17 +00:00
2014-09-20 22:59:36 +00:00
ua _ver _lt = function ( a , b ) {
2012-04-04 23:07:17 +00:00
if ( - 1 == this . ua _ver _cmp ( a , b ) ) { return true ; }
return false ;
2012-04-09 20:08:35 +00:00
} ;
2014-09-20 22:59:36 +00:00
ua _ver _gt = function ( a , b ) {
2012-04-04 23:07:17 +00:00
if ( 1 == this . ua _ver _cmp ( a , b ) ) { return true ; }
return false ;
2012-04-09 20:08:35 +00:00
} ;
2014-09-20 22:59:36 +00:00
ua _ver _eq = function ( a , b ) {
2012-04-04 23:07:17 +00:00
if ( 0 == this . ua _ver _cmp ( a , b ) ) { return true ; }
return false ;
2012-04-09 20:08:35 +00:00
} ;