Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Commit

Permalink
Automatically build from WhichBrowser/Parser and WhichBrowser/Server
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsLeenheer committed Feb 17, 2016
1 parent 33cf5a8 commit f3f7f73
Show file tree
Hide file tree
Showing 8 changed files with 2,822 additions and 2,241 deletions.
2 changes: 2 additions & 0 deletions data/browsers-bots.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
[ 'name' => 'Bing', 'regexp' => '/msnbot-media\/([0-9.]*)/u' ],
[ 'name' => 'Bing', 'regexp' => '/MsnBot-Media \/([0-9.]*)/u' ],
[ 'name' => 'Bing', 'regexp' => '/msnbot-NewsBlogs\/([0-9.]*)/u' ],
[ 'name' => 'Bing', 'regexp' => '/MSNBOT_Mobile/u' ],
[ 'name' => 'Bing', 'regexp' => '/MSMOBOT/u' ],
[ 'name' => 'Bing Preview', 'regexp' => '/BingPreview\/([0-9.]*)/u' ],
[ 'name' => 'Bloglines', 'regexp' => '/Bloglines\/([0-9.]*)/u' ],
[ 'name' => 'Bloglovin', 'regexp' => '/Bloglovin\/([0-9.]*)/u' ],
Expand Down
4,852 changes: 2,642 additions & 2,210 deletions data/models-android.php

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions data/models-wm.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'GIGABYTE-MS800' => [ 'Gigabyte', 'GSmart MS800' ],
'HP iPAQ 510' => [ 'HP', 'iPAQ 510' ],
'HPiPAQ510!' => [ 'HP', 'iPAQ 510' ],
'iPAQ610' => [ 'HP', 'iPAQ 610' ],
'HPiPAQ610' => [ 'HP', 'iPAQ 610' ],
'HPiPAQ910!' => [ 'HP', 'iPAQ 910' ],
'HP iPAQ h6300' => [ 'HP', 'iPAQ h6300' ],
'HP iPAQ hw6500!' => [ 'HP', 'iPAQ hw6500' ],
Expand All @@ -51,6 +51,7 @@
'HPiPAQVoiceMessenger!' => [ 'HP', 'iPAQ Voice Messenger' ],
'HPiPAQGlisten' => [ 'HP', 'iPAQ Glisten' ],
'HP KB1' => [ 'HP', 'iPAQ Glisten' ],
'HTC8500' => [ 'HTC', '8500' ],
'HTC P3300' => [ 'HTC', 'P3300' ],
'HTC love' => [ 'HTC', 'P3350' ],
'HTC P3350' => [ 'HTC', 'P3350' ],
Expand Down Expand Up @@ -105,6 +106,7 @@
'(HTC Touch Viva |.*T2223)!' => [ 'HTC', 'Touch Viva' ],
'P3600!' => [ 'HTC', 'Trinity' ],
'HTC Trinity' => [ 'HTC', 'Trinity' ],
'HTC P3600' => [ 'HTC', 'Trinity' ],
'HTC TyTN II' => [ 'HTC', 'TyTN II' ],
'P4550' => [ 'HTC', 'TyTN II' ],
'HTC Kaiser' => [ 'HTC', 'TyTN II' ],
Expand All @@ -127,23 +129,25 @@
'i-mate 9502!' => [ 'i-mate', 'Ultimate 9502' ],
'W366' => [ 'K-Touch', 'W366' ],
'K-Touch W366!' => [ 'K-Touch', 'W366' ],
'Kyocera-E4000' => [ 'Kyocera', 'Solo E4000' ],
'Lenovo ET860' => [ 'Lenovo', 'ET860' ],
'LENOVO-ET980' => [ 'Lenovo', 'ET980' ],
'LG-GM730!' => [ 'LG', 'Eigen GM730' ],
'GM730' => [ 'LG', 'Eigen GM730' ],
'LG-GM750!' => [ 'LG', 'Layla GM750' ],
'GM750Q' => [ 'LG', 'Layla GM750' ],
'LG-GW550!' => [ 'LG', 'GW550' ],
'GW550' => [ 'LG', 'GW550' ],
'GW825' => [ 'LG', 'IQ GW825' ],
'LG-KS20' => [ 'LG', 'KS20' ],
'LG-MS25' => [ 'LG', 'MS25' ],
'VS750' => [ 'LG', 'Fathom VS750' ],
'LGE VS750' => [ 'LG', 'Fathom VS750' ],
'A3100' => [ 'Motorola', 'A3100' ],
'A3300c' => [ 'Motorola', 'A3300c' ],
'A4500!' => [ 'Motorola', 'A4500' ],
'ES405B' => [ 'Motorola', 'ES405 Enterprise Smartphone' ],
'MC45' => [ 'Motorola', 'MC45 Mobile Computer' ],
'MC659B' => [ 'Motorola', 'MC65 Wireless Rugged Mobile Computer' ],
'ES405B!' => [ 'Motorola', 'ES405 Enterprise Smartphone' ],
'MC45!' => [ 'Motorola', 'MC45 Mobile Computer' ],
'MC659B!' => [ 'Motorola', 'MC65 Wireless Rugged Mobile Computer' ],
'Q-UMTS' => [ 'Motorola', 'Q' ],
'Q8' => [ 'Motorola', 'MOTO Q8' ],
'Q9' => [ 'Motorola', 'MOTO Q9' ],
Expand All @@ -154,6 +158,7 @@
'H-21' => [ 'Opticom', 'H-21' ],
'\/Palm500!' => [ 'Palm', 'Treo 500v' ],
'Palm750' => [ 'Palm', 'Treo 750' ],
'Treo800w' => [ 'Palm', 'Treo 800w' ],
'Palm Treo850e' => [ 'Palm', 'Treo Pro' ],
'Sprint Treo850e' => [ 'Palm', 'Treo Pro' ],
'PANTECH-C810' => [ 'Pantech', 'Duo C810' ],
Expand Down Expand Up @@ -200,7 +205,7 @@
'X2' => [ 'Sony Ericsson', 'Xperia X2' ],
'X2[ia]!' => [ 'Sony Ericsson', 'Xperia X2' ],
'Spice D1100' => [ 'Spice', 'D1100' ],
'TG01' => [ 'Toshiba', 'TG01' ],
'(Toshiba[- ])?TG01!' => [ 'Toshiba', 'TG01' ],
'Velocity' => [ 'Velocity', '111' ],
'ZTE E N72' => [ 'ZTE', 'E N72' ],
'ZTE E X70' => [ 'ZTE', 'E X70' ],
Expand All @@ -226,10 +231,12 @@
'SPV M3100' => [ 'Orange', 'SPV M3100' ],

'Sprint S511' => [ 'Sprint', 'Snap' ],
'Sprint:SPH-ip830w' => [ 'Sprint', 'SPH-ip830w' ],
'Sprint:PPC6600-1' => [ 'Sprint', 'PPC6600' ],
'Sprint:PPC-6700' => [ 'Sprint', 'PPC6700' ],
'Sprint:PPC6800' => [ 'Sprint', 'PPC6800' ],
'Sprint PPC6850SP' => [ 'Sprint', 'PPC6850' ],
'HTCPPC6850!' => [ 'Sprint', 'PPC6850' ],
'PPC6850!' => [ 'Sprint', 'PPC6850' ],
'Sprint MP6850SP' => [ 'Sprint', 'MP6850' ],
'Sprint MP6900SP' => [ 'Sprint', 'MP6900' ],
Expand All @@ -247,19 +254,20 @@
'MDA Touch!' => [ 'T-Mobile', 'MDA Touch' ],
'MDA Vario!' => [ 'T-Mobile', 'MDA Vario' ],

'XV6175' => [ 'Verizon', 'Ozone XV6175' ],
'XV6175.1' => [ 'Verizon', 'Ozone XV6175' ],
'XV6875.1' => [ 'Verizon', 'Touch Pro2 XV6875' ],
'XV6175!' => [ 'Verizon', 'Ozone XV6175' ],
'XV6875!' => [ 'Verizon', 'Touch Pro2 XV6875' ],
'XV6900' => [ 'Verizon', 'Touch XV6900' ],
'XV6975' => [ 'Verizon', 'Imagio XV6975' ],

'SFR v3650!' => [ 'Vodafone', 'Polaris' ],
'v1415' => [ 'Vodafone', 'Vox' ],
'v1240' => [ 'Vodafone', 'VDA II' ],
'1210' => [ 'Vodafone', 'VDA IV' ],
'v1210' => [ 'Vodafone', 'VDA IV' ],
'HTC VDA V' => [ 'Vodafone', 'VDA V' ],
'v1640' => [ 'Vodafone', 'VPA IV' ],
'VPA Touch' => [ 'Vodafone', 'VPA Touch' ],
'HTC v1510' => [ 'Vodafone', 'VPA Compact GPS' ],
'HTC VPACompactIV' => [ 'Vodafone', 'VPA Compact IV' ],


Expand Down
83 changes: 81 additions & 2 deletions src/Analyser/Header/Useragent/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,52 @@ private function &detectApplication($ua)

private function detectSpecificApplications($ua)
{
/* "Android Application" */

if (preg_match('/^(.+) Android Application \([0-9]+, .+ v([0-9\.]+)\) - [a-z]+ (.*) [a-z]+ - [0-9A-F]{8,8}-[0-9A-F]{4,4}-[0-9A-F]{4,4}-[0-9A-F]{4,4}-[0-9A-F]{12,12}$/iu', $ua, $match)) {
$this->data->browser->name = $match[1];
$this->data->browser->version = null;
$this->data->browser->type = Constants\BrowserType::APP;

$this->data->os->reset([
'name' => 'Android',
'version' => new Version([ 'value' => $match[2] ])
]);

$this->data->device->model = $match[3];
$this->data->device->identified |= Constants\Id::PATTERN;
$this->data->device->type = Constants\DeviceType::MOBILE;

$device = Data\DeviceModels::identify('android', $match[3]);
if ($device->identified) {
$device->identified |= $this->data->device->identified;
$this->data->device = $device;
}
}

/* Instagram */

if (preg_match('/^Instagram ([0-9\.]+) Android \([0-9]+\/([0-9\.]+); [0-9]+dpi; [0-9]+x[0-9]+; [^;]+; ([^;]*);/iu', $ua, $match)) {
$this->data->browser->name = 'Instagram';
$this->data->browser->version = new Version([ 'value' => $match[1] ]);
$this->data->browser->type = Constants\BrowserType::APP_SOCIAL;

$this->data->os->reset([
'name' => 'Android',
'version' => new Version([ 'value' => $match[2] ])
]);

$this->data->device->model = $match[3];
$this->data->device->identified |= Constants\Id::PATTERN;
$this->data->device->type = Constants\DeviceType::MOBILE;

$device = Data\DeviceModels::identify('android', $match[3]);
if ($device->identified) {
$device->identified |= $this->data->device->identified;
$this->data->device = $device;
}
}

/* Dr. Web Anti-Virus */

if (preg_match('/Dr\.Web anti\-virus Light Version: ([0-9\.]+) Device model: (.*) Firmware version: ([0-9\.]+)/u', $ua, $match)) {
Expand Down Expand Up @@ -141,10 +187,21 @@ private function detectSpecificApplications($ua)

/* Yahoo */

if (preg_match('/YahooMobile(?:Messenger|Mail)\/1.0 \(Android (Messenger|Mail); ([0-9\.]+)\) \([^;]+; ?[^;]+; ?([^;]+); ?([0-9\.]+)\/[^\;\)\/]+\)/u', $ua, $match)) {
if (preg_match('/YahooMobile(?:Messenger|Mail|Weather)\/1.0 \(Android (Messenger|Mail|Weather); ([0-9\.]+)\) \([^;]+; ?[^;]+; ?([^;]+); ?([0-9\.]+)\/[^\;\)\/]+\)/u', $ua, $match)) {
$this->data->browser->name = 'Yahoo ' . $match[1];
$this->data->browser->version = new Version([ 'value' => $match[2], 'details' => 3 ]);
$this->data->browser->type = $match[1] == 'Messenger' ? Constants\BrowserType::APP_CHAT : Constants\BrowserType::APP_EMAIL;

switch ($match[1]) {
case 'Messenger':
$this->data->browser->type = Constants\BrowserType::APP_CHAT;
break;
case 'Mail':
$this->data->browser->type = Constants\BrowserType::APP_EMAIL;
break;
case 'Weather':
$this->data->browser->type = Constants\BrowserType::APP_NEWS;
break;
}

$this->data->os->reset([
'name' => 'Android',
Expand All @@ -159,6 +216,28 @@ private function detectSpecificApplications($ua)
$this->data->device = $device;
}
}

/* Yahoo Mobile App */

if (preg_match('/YahooJMobileApp\/[0-9\.]+ \(Android [a-z]+; ([0-9\.]+)\) \([^;]+; ?[^;]+; ?[^;]+; ?([^;]+); ?([0-9\.]+)\/[^\;\)\/]+\)/u', $ua, $match)) {
$this->data->browser->name = 'Yahoo Mobile';
$this->data->browser->version = new Version([ 'value' => $match[1], 'details' => 3 ]);
$this->data->browser->type = Constants\BrowserType::APP_SEARCH;

$this->data->os->reset([
'name' => 'Android',
'version' => new Version([ 'value' => $match[3] ])
]);

$this->data->device->type = Constants\DeviceType::MOBILE;

$device = Data\DeviceModels::identify('android', $match[2]);
if ($device->identified) {
$device->identified |= $this->data->device->identified;
$this->data->device = $device;
}
}

}

private function detectRemainingApplications($ua)
Expand Down
29 changes: 26 additions & 3 deletions src/Analyser/Header/Useragent/Device/Mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private function detectSamsung($ua)
return;
}

if (preg_match('/(?:SAMSUNG; )?SAMSUNG[-\/ ]?([^\/\)_]+)/ui', $ua, $match)) {
if (preg_match('/(?:SAMSUNG; )?SAMSUNG[-\/ ]?([^;\/\)_]+)/ui', $ua, $match)) {
$this->data->device->manufacturer = 'Samsung';
$this->data->device->model = Data\DeviceModels::cleanup($match[1]);
$this->data->device->identifier = $match[0];
Expand Down Expand Up @@ -241,6 +241,10 @@ private function detectSamsung($ua)

private function detectGenericMobileModels($ua)
{
if ($this->data->device->identified & Constants\Id::PATTERN) {
return;
}

if (isset($this->data->device->manufacturer)) {
return;
}
Expand Down Expand Up @@ -993,7 +997,7 @@ private function detectGenericMobileLocations($ua)
array_push($candidates, $match[1]);
}

if (preg_match('/[; ]([^\s\)\/;]+)[^\s;]*$/u', $ua, $match)) {
if (preg_match('/[; ]\(?([^\s\)\/;]+)[^\s;]*$/u', $ua, $match)) {
array_push($candidates, $match[1]);
}

Expand All @@ -1019,7 +1023,26 @@ private function detectGenericMobileLocations($ua)
'Sleipnir', 'MobileSafari', 'MQQBrowser', 'BREW', '?',
'Maxthon', '360%20Browser', 'OPR', 'CFNetwork', 'JUC', 'Skyfire',
'UP.Browser', 'DolphinHDCN', 'NintendoBrowser', 'NCSA',
'NCSA Mosaic', 'NCSA_Mosaic', 'U'
'NCSA Mosaic', 'NCSA_Mosaic', 'U', 'NetFrontNX', 'QtWebKit',
'HtmlRenderer', 'HbbTV', 'WebAppManager', 'SmartTV', 'UPLUSTVBROWSER',
'LG Browser', 'LG', 'LGSmartTV', 'OBIGO-T10', 'Linux', 'DLNADOC',
'Aplix_SANYO_browser', 'Japanese', 'WebBrowser', 'Freetime',
'OreganMediaBrowser', 'NETRANGEMMH', 'http:', 'bxapi', 'Kodi',
'XBMC', 'KreaTVWebKit', 'MachBlue', 'Espial', 'TouchPad',
'sharp', 'sharp wd browser', 'sharp pda browser', 'browser',
'Palmscape', 'CorePlayer', 'Xiino', 'SONY', 'WorldTALK', 'TOPS',
'Windows', 'Microsoft Pocket Internet Explorer', 'Explorer',
'CE', 'Desktop', 'Maemo Browser', 'Maemo', 'baidubrowser',
'Mercury', 'BREW-Applet', 'ucweb-squid', 'iSurf', '3gpp-gba',
'InfoPath.2', 'UC', 'J2ME', 'IUC', 'AveFront', 'MMP', 'BaiduHD',
'360%20Lite', '360', 'AppleWebKit', 'Instagram', 'FBOP',
'Nuanti', 'NuantiMeta', 'Silk', 'VTE', 'DreamKey', 'DreamPassport',
'Aplix_SEGASATURN_browser', 'NWF', 'Bunjalloo', 'libwww',
'Inferno', 'NEXT', 'I', 'Microsoft Internet Explorer', 'MAM3',
'MAM2', '360SE', 'Ziepod', 'Vista', 'XP', 'Links', 'Syllable',
'sun4m', 'sun4c', 'sun4u', 'i86pc', 'X11', 'NaenaraBrowser',
'QuickTime', 'IBM', 'QQBrowser', 'x86_64', 'i686', 'i386', 'Chrome',
'TenFourFox', 'Swing', 'NetFrontBrowserNX', 'Mac_PowerPC',
]);

$candidates = array_unique($candidates);
Expand Down
Loading

0 comments on commit f3f7f73

Please sign in to comment.