issue 147 : OS detection for iPhone - first draft

git-svn-id: https://beef.googlecode.com/svn/trunk@583 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
xntrik
2010-11-27 09:17:36 +00:00
parent 8543036851
commit 90c885ad36
4 changed files with 13 additions and 3 deletions

View File

@@ -81,8 +81,10 @@ module Constants
OS_LINUX_IMG = 'linux.png'
OS_MAC_UA_STR = 'Mac'
OS_MAC_IMG = 'mac.png'
OS_IPHONE_UA_STR = 'iPhone'
OS_IPHONE_IMG = 'iphone.png'
end
end
end
end

View File

@@ -82,6 +82,7 @@ class BrowserDetails
return BeEF::Constants::Os::OS_UNKNOWN_IMG if ua_string.nil? # Unknown
return BeEF::Constants::Os::OS_WINDOWS_IMG if ua_string.include? BeEF::Constants::Os::OS_WINDOWS_UA_STR # Windows
return BeEF::Constants::Os::OS_LINUX_IMG if ua_string.include? BeEF::Constants::Os::OS_LINUX_UA_STR # Linux
return BeEF::Constants::Os::OS_IPHONE_IMG if ua_string.include? BeEF::Constants::Os::OS_IPHONE_UA_STR # iPhone - do this before Mac, because it includes Mac
return BeEF::Constants::Os::OS_MAC_IMG if ua_string.include? BeEF::Constants::Os::OS_MAC_UA_STR # Mac OS X
BeEF::Constants::Os::OS_UNKNOWN_IMG
@@ -90,4 +91,4 @@ class BrowserDetails
end
end
end
end

View File

@@ -58,6 +58,10 @@ beef.os = {
return (this.ua.match('(Mac_PowerPC)|(Macintosh)|(MacIntel)')) ? true : false;
},
isIphone: function() {
return (this.ua.indexOf('iPhone') != -1) ? true : false;
},
isQNX: function() {
return (this.ua.indexOf('QNX')) ? true : false;
},
@@ -83,6 +87,9 @@ beef.os = {
//linux
if(this.isLinux()) return 'Linux';
if(this.isSunOS()) return 'Sun OS';
//iPhone
if (this.isIphone()) return 'iPhone';
//macintosh
if(this.isMacintosh()) {
@@ -100,4 +107,4 @@ beef.os = {
}
};
beef.regCmp('beef.net.os');
beef.regCmp('beef.net.os');

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB