From d09178b60cc069c8a6926eebacbc27fe74a60f55 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Mon, 25 Nov 2013 01:28:07 +0100 Subject: [PATCH] detect some more UAs and details, like Chromium specifically, now Googlebot-Mobile versions, Mobile/Tableton Firefox OS, etc. --- include/classes/useragent.php-class | 22 ++++++++++++++-------- testbed/ua_list.php | 2 +- testbed/ua_list_raw.txt | 9 ++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/include/classes/useragent.php-class b/include/classes/useragent.php-class index dffa0c8..3dff7ae 100755 --- a/include/classes/useragent.php-class +++ b/include/classes/useragent.php-class @@ -359,6 +359,11 @@ class userAgent { $this->version = $regs[1]; $this->bot = false; } + elseif (preg_match('|Chromium/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { + $this->brand = 'Chromium'; + $this->version = $regs[1]; + $this->bot = false; + } elseif (preg_match('|Chrome/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { $this->brand = 'Chrome'; $this->version = $regs[1]; @@ -394,6 +399,12 @@ class userAgent { $this->version = $regs[1]; $this->bot = false; } + elseif (preg_match('|Googlebot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Webkit! */ + $this->brand = 'Googlebot-Mobile'; + $this->version = $regs[1]; + $this->bot = true; + $this->mobile = true; + } elseif (preg_match('|Safari/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { if (preg_match('| Mobile(/[0-9a-zA-Z\.+]+)? ?Safari/|', $this->uastring)) { $this->brand = 'Mobile Safari'; @@ -463,12 +474,6 @@ class userAgent { $this->bot = true; $this->mobile = true; } - elseif (preg_match('|Googlebot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */ - $this->brand = 'Googlebot-Mobile'; - $this->version = $regs[1]; - $this->bot = true; - $this->mobile = true; - } elseif (preg_match('|FASTMobileCrawl/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */ $this->brand = 'FASTMobileCrawl'; $this->version = $regs[1]; @@ -1178,7 +1183,7 @@ class userAgent { $this->mobile = ($regs[2] == 'Mobile'); } elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); [^;]+; rv:([^\);]+)\)#', $this->uastring, $regs)) { - $this->uadata['os'] = 'Firefox OS'; + $this->uadata['os'] = 'Firefox OS ('.$regs[1].')'; $this->uadata['lang'] = null; $this->uadata['eng_version'] = $regs[2]; $this->mobile = ($regs[1] == 'Mobile'); @@ -1199,7 +1204,7 @@ class userAgent { $this->uadata['eng_version'] = null; } elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); rv:([^\);]+)\)#', $this->uastring, $regs)) { - $this->uadata['os'] = 'Firefox OS'; + $this->uadata['os'] = 'Firefox OS ('.$regs[1].')'; $this->uadata['lang'] = null; $this->uadata['eng_version'] = $regs[2]; $this->mobile = ($regs[1] == 'Mobile'); @@ -1511,6 +1516,7 @@ class userAgent { elseif (strpos($this->uadata['os'], 'MeeGo') !== false) { $this->uadata['platform'] = 'Linux'; } elseif (strpos($this->uadata['os'], 'webOS') !== false) { $this->uadata['platform'] = 'Linux'; } elseif (strpos($this->uadata['os'], 'Android') !== false) { $this->uadata['platform'] = 'Android'; } + elseif (strpos($this->uadata['os'], 'Firefox OS') !== false) { $this->uadata['platform'] = 'Firefox OS'; } elseif (strpos($this->uadata['os'], 'Solaris') !== false) { $this->uadata['platform'] = 'Solaris'; } elseif (strpos($this->uadata['os'], 'SunOS') !== false) { $this->uadata['platform'] = 'Solaris'; } elseif (strpos($this->uadata['os'], 'BeOS') !== false) { $this->uadata['platform'] = 'BeOS'; } diff --git a/testbed/ua_list.php b/testbed/ua_list.php index 7f8302d..3b417af 100644 --- a/testbed/ua_list.php +++ b/testbed/ua_list.php @@ -36,7 +36,7 @@ if (count($ualist)) { if (substr($uastring, 0, 1) == '#') { // comment print(' '."\n"); - print(' '.substr($uastring, 1).''."\n"); + print(' '.substr($uastring, 1).''."\n"); print(' '."\n"); } else { diff --git a/testbed/ua_list_raw.txt b/testbed/ua_list_raw.txt index 7715f1f..6c400c9 100755 --- a/testbed/ua_list_raw.txt +++ b/testbed/ua_list_raw.txt @@ -55,6 +55,7 @@ Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20.0 Firefox/20.0 Mozilla/5.0 (Android; Mobile; rv:12.0) Gecko/12.0 Firefox/12.0 Mozilla/5.0 (Android; Tablet; rv:14.0a1) Gecko/14 Firefox/14.0a1 +Mozilla/5.0 (Android; Tablet; rv:28.0) Gecko/28.0 Firefox/28.0 Mozilla/5.0 (Android; rv:20.0) Gecko/20.0 Firefox/20.0 Mozilla/5.0 (Android; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1 Mozilla/5.0 (Android; Linux armv7l; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Fennec/2.0b1pre @@ -204,8 +205,11 @@ Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14. Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.51 (KHTML, like Gecko; Google Web Preview) Chrome/12.0.742 Safari/534.51 Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19 Mozilla/5.0 (Linux; Android 4.0.3; Transformer TF 101 Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Safari/535.19 +Mozilla/5.0 (Linux; Android 4.0.4; Micromax P500(Funbook) Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.59 Safari/537.36 +Mozilla/5.0 (Linux; Android 4.4; Nexus 10 Build/KRT16S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Safari/537.36 Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Large Screen Safari/533.4 GoogleTV/ 162671 -Mozilla/5.0 (X11; U: Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Large Screen Safari/533.4 GoogleTV/b39389 +Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Large Screen Safari/533.4 GoogleTV/b39389 +Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.52 Chrome/28.0.1500.52 Safari/537.36 Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/21.0.025; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE63-3/100.21.110; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 @@ -383,6 +387,7 @@ NetResearchServer/2.7(loopimprovements.com/robot.html) dloader(NaverRobot)/1.0 Webchat/2.0 (www.webchat.de user crawler) msnbot/1.0 (+http://search.msn.com/msnbot.htm) +msnbot/2.0b (+http://search.msn.com/msnbot.htm) Gigabot/2.0 Mediapartners-Google/2.1 Schmozilla/v9.14 Platinum @@ -417,6 +422,7 @@ Mozilla/5.0 (compatible; GalaxyBot/2.0; +http://www.galaxy.com/) Mozilla/4.0 (compatible; NaverBot/1.0; http://help.naver.com/delete_main.asp) Mozilla/5.0 (compatible;FindITAnswersbot/1.0; http://search.it-influentials.com/bot.htm) Mozilla/5.0 (compatible: Nebullabot/2.2) +Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://ahrefs.com/robot/) Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) VoilaBot BETA 1.2 (http://www.voila.com/) Mozilla/4.0 (efp@gmx.net) Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) @@ -452,6 +458,7 @@ Mozilla/5.0 (compatible;archive.org_bot/1.7.0; Archive-It; +http://www.archive-i Mozilla/5.0 (compatible;picmole/1.0 +http://www.picmole.com) Mozilla/5.0 (X11; compatible; crawler@newstin.com; HTTPClient 3.1) Mozilla/4.0 (MobilePhone SCP-5500/US/1.0) NetFront/3.0 MMP/2.0 FAKE (compatible; Googlebot/2.1; +http://www.google.com/bot.html) +Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html) Nokia6681/1.0 (2.30.0) Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 (compatible; baiduspider; +http://www.baidu.com/search/spider.html) Nokia3650/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0/ (compatible; YodaoBot-Mobile/1.0; http://www.youdao.com/help/webmaster/spider/; ) NokiaN70/. FASTMobileCrawl/6.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 -- 2.43.0