Added BlackBerry and Nokia (Symbian/Maemo) OS detection from useragent

git-svn-id: https://beef.googlecode.com/svn/trunk@1253 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
bcoles@gmail.com
2011-09-02 10:56:41 +00:00
parent 3556268718
commit 203173b621
4 changed files with 28 additions and 2 deletions

View File

@@ -81,6 +81,14 @@ beef.os = {
return (this.ua.indexOf('iPad') != -1) ? true : false;
},
isNokia: function() {
return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
},
isBlackBerry: function() {
return (this.ua.indexOf('BlackBerry')) ? true : false;
},
isQNX: function() {
return (this.ua.indexOf('QNX')) ? true : false;
},
@@ -102,7 +110,20 @@ beef.os = {
if(this.isWinServer2003()) return 'Windows Server 2003';
if(this.isWinVista()) return 'Windows Vista';
if(this.isWin7()) return 'Windows 7';
//Nokia
if(this.isNokia()) {
if (this.ua.indexOf('Maemo Browser') != -1) return 'Maemo';
if (this.ua.match('(SymbianOS)|(Symbian OS)')) return 'SymbianOS';
if (this.ua.indexOf('Symbian') != -1) return 'Symbian';
//return 'Nokia';
}
// BlackBerry
if(this.isBlackBerry()) return 'BlackBerry OS';
//linux
if(this.isLinux()) return 'Linux';
if(this.isSunOS()) return 'Sun OS';

View File

@@ -29,6 +29,8 @@ module Constants
OS_MAC_IMG = 'mac.png'
OS_IPHONE_UA_STR = 'iPhone'
OS_IPHONE_IMG = 'iphone.png'
OS_BLACKBERRY_UA_STR = 'BlackBerry'
OS_BLACKBERRY_IMG = 'blackberry.png'
OS_ALL_UA_STR = 'All'
def self.match_os(name)
@@ -41,6 +43,8 @@ module Constants
OS_MAC_UA_STR
when /iphone/
OS_IPHONE_UA_STR
when /blackberry/
OS_BLACKBERRY_UA_STR
else
'ALL'
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

View File

@@ -104,6 +104,7 @@ module Models
return BeEF::Core::Constants::Os::OS_LINUX_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_LINUX_UA_STR
return BeEF::Core::Constants::Os::OS_IPHONE_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPHONE_UA_STR
return BeEF::Core::Constants::Os::OS_MAC_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAC_UA_STR
return BeEF::Core::Constants::Os::OS_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BLACKBERRY_UA_STR
BeEF::Core::Constants::Os::OS_UNKNOWN_IMG
end
@@ -113,4 +114,4 @@ module Models
end
end
end
end
end