From 90c885ad365538c04b6fc71c4a90a8152189e1db Mon Sep 17 00:00:00 2001 From: xntrik Date: Sat, 27 Nov 2010 09:17:36 +0000 Subject: [PATCH] issue 147 : OS detection for iPhone - first draft git-svn-id: https://beef.googlecode.com/svn/trunk@583 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- lib/constants.rb | 4 +++- lib/model/browserdetails.rb | 3 ++- modules/beefjs/os.js | 9 ++++++++- public/images/icons/iphone.png | Bin 0 -> 1577 bytes 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 public/images/icons/iphone.png diff --git a/lib/constants.rb b/lib/constants.rb index 145825fe3..00af3249f 100644 --- a/lib/constants.rb +++ b/lib/constants.rb @@ -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 \ No newline at end of file +end diff --git a/lib/model/browserdetails.rb b/lib/model/browserdetails.rb index f4e127cce..6a62ad6bd 100644 --- a/lib/model/browserdetails.rb +++ b/lib/model/browserdetails.rb @@ -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 \ No newline at end of file +end diff --git a/modules/beefjs/os.js b/modules/beefjs/os.js index 668a1a42e..f7efd172f 100644 --- a/modules/beefjs/os.js +++ b/modules/beefjs/os.js @@ -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'); \ No newline at end of file +beef.regCmp('beef.net.os'); diff --git a/public/images/icons/iphone.png b/public/images/icons/iphone.png new file mode 100644 index 0000000000000000000000000000000000000000..ab4a8cc31a0e0ba8e9760ff502ac56c4b155e0b9 GIT binary patch literal 1577 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xa$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%u1Od5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|80+w{G(j&jGsVi>$i&3L#o64=(A>n((8bNdz|hRe%+Yq3v0*Y)REP|r^ zO>!b4o!&jt=REE#77&`=vtY8%oHMih{6nLSf2?3%|KRV}{r~@_+DOVpPV!Pc|Af2M zOm%8+;*4pTY|AniW!Lh2xohfscuJ6{w6wH)*}EI}wB6kA&#}CEzkEZ8*2WbpTLUy& za&O-_Urt)IuKQXxx9+`fe=5Jpyf`wQ@o~BPi>&*{BFx(N zmr4HKRrcY<$M9QbYpx3&;^DP*S*akIVI$r@4F~@fM^$v1zGTxgzyJ8{?(aU~wOaK;OXjI*uK5>x zzbMTrdb3C80f!kv*J|S&Ji9l}w7(<&``i_mSx?W&yeu#DGQNCfn~v*`NnOi-Pcdql zcfI^@)4O}lA*WgW?*DgP@n7np^mL1BpBi#y-CxS>IC^dGYL1tz`(Dg+dFk1bI4B_mu{Xi&tBpGQ&axSn_a?cpI!gKuD2{qsMI7{F?hSnm3`BmhwrTWJhSZ5 zf=OpDlzcOY`=%d$`tzNg)0373ELl6@umP*1o%dF@kj6{ANXwJH^=7Sxo>A{ zBRO slZC_c_p43y5#qG=SgU^_mdKI;Vst0KP