Added Android OS detection from useragent

git-svn-id: https://beef.googlecode.com/svn/trunk@1254 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
bcoles@gmail.com
2011-09-02 11:35:20 +00:00
parent 203173b621
commit ca4e2d18f5
4 changed files with 12 additions and 0 deletions

View File

@@ -85,6 +85,10 @@ beef.os = {
return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
},
isAndroid: function() {
return (this.ua.indexOf('Android')) ? true : false;
},
isBlackBerry: function() {
return (this.ua.indexOf('BlackBerry')) ? true : false;
},
@@ -124,6 +128,9 @@ beef.os = {
// BlackBerry
if(this.isBlackBerry()) return 'BlackBerry OS';
// Android
if(this.isAndroid()) return 'Android';
//linux
if(this.isLinux()) return 'Linux';
if(this.isSunOS()) return 'Sun OS';

View File

@@ -31,6 +31,8 @@ module Constants
OS_IPHONE_IMG = 'iphone.png'
OS_BLACKBERRY_UA_STR = 'BlackBerry'
OS_BLACKBERRY_IMG = 'blackberry.png'
OS_ANDROID_UA_STR = 'Android'
OS_ANDROID_IMG = 'android.png'
OS_ALL_UA_STR = 'All'
def self.match_os(name)
@@ -45,6 +47,8 @@ module Constants
OS_IPHONE_UA_STR
when /blackberry/
OS_BLACKBERRY_UA_STR
when /android/
OS_ANDROID_UA_STR
else
'ALL'
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -105,6 +105,7 @@ module Models
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
return BeEF::Core::Constants::Os::OS_ANDROID_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_ANDROID_UA_STR
BeEF::Core::Constants::Os::OS_UNKNOWN_IMG
end