2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2008-07-22 07:28:05 +00:00
|
|
|
|
2011-06-03 00:36:26 +00:00
|
|
|
require 'msf/core'
|
2008-07-22 07:28:05 +00:00
|
|
|
require 'rex/text'
|
2011-06-03 00:36:26 +00:00
|
|
|
require 'rex/exploitation/jsobfu'
|
2008-07-22 07:28:05 +00:00
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Exploitation
|
|
|
|
|
2011-12-30 17:55:01 +00:00
|
|
|
#
|
2009-11-24 21:40:02 +00:00
|
|
|
# Provides several javascript functions for determining the OS and browser versions of a client.
|
|
|
|
#
|
|
|
|
# getVersion(): returns an object with the following properties
|
2009-12-29 23:48:45 +00:00
|
|
|
# os_name - OS name, one of the Msf::OperatingSystems constants
|
2009-11-24 21:40:02 +00:00
|
|
|
# os_flavor - OS flavor as a string (e.g.: "XP", "2000")
|
|
|
|
# os_sp - OS service pack (e.g.: "SP2", will be empty on non-Windows)
|
|
|
|
# os_lang - OS language (e.g.: "en-us")
|
2009-12-29 23:48:45 +00:00
|
|
|
# ua_name - Client name, one of the Msf::HttpClients constants
|
2009-11-24 21:40:02 +00:00
|
|
|
# ua_version - Client version as a string (e.g.: "3.5.1", "6.0;SP2")
|
|
|
|
# arch - Architecture, one of the ARCH_* constants
|
|
|
|
#
|
|
|
|
# The following functions work on the version returned in obj.ua_version
|
|
|
|
#
|
|
|
|
# ua_ver_cmp(a, b): returns -1, 0, or 1 based on whether a < b, a == b, or a > b respectively
|
|
|
|
# ua_ver_lt(a, b): returns true if a < b
|
|
|
|
# ua_ver_gt(a, b): returns true if a > b
|
|
|
|
# ua_ver_eq(a, b): returns true if a == b
|
|
|
|
#
|
2011-06-03 00:36:26 +00:00
|
|
|
class JavascriptOSDetect < JSObfu
|
2011-12-30 17:55:01 +00:00
|
|
|
|
2008-07-22 07:28:05 +00:00
|
|
|
def initialize(custom_js = '', opts = {})
|
|
|
|
@js = custom_js
|
2012-04-05 07:22:27 +00:00
|
|
|
@js += ::File.read(::File.join(::File.dirname(__FILE__), "javascriptosdetect.js"))
|
2008-07-22 07:28:05 +00:00
|
|
|
|
|
|
|
super @js
|
|
|
|
|
|
|
|
return @js
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-11-21 05:37:28 +00:00
|
|
|
end
|