Skip to content

Commit

Permalink
Adds detection for Jaunt, PhantomJS and improves detection for other …
Browse files Browse the repository at this point in the history
…libraries (#7768)

* Adds detection for Jaunt

* Improves detection

* Move Cypress to libraries

* Remove Dezor from this PR

* Adds detection for PhantomJS

* Move back browser before library

* Improves detection for Android Browser

* Improves detection for Cypress and PhantomJS
  • Loading branch information
liviuconcioiu authored Nov 14, 2024
1 parent aab8aa0 commit 8ad6d49
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ public function parse(): ?array
}
}

if (empty($name)) {
if (empty($name) || 1 === \preg_match('/Cypress|PhantomJS/', $this->userAgent)) {
return [];
}

Expand Down
24 changes: 24 additions & 0 deletions Tests/Parser/Client/fixtures/library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -695,3 +695,27 @@
type: library
name: quic-go
version: ""
-
user_agent: Jaunt/1.5
client:
type: library
name: Jaunt
version: "1.5"
-
user_agent: Android.LVLDM
client:
type: library
name: Android License Verification Library
version: ""
-
user_agent: Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/12.1.0 Chrome/106.0.5249.51 Electron/21.0.0 Safari/537.36
client:
type: library
name: Cypress
version: 12.1.0
-
user_agent: Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1
client:
type: library
name: PhantomJS
version: 2.1.1
9 changes: 0 additions & 9 deletions Tests/fixtures/bots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7050,15 +7050,6 @@
producer:
name: Ghost Inspector, Inc.
url: https://www.ghostinspector.com/
-
user_agent: Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/12.1.0 Chrome/106.0.5249.51 Electron/21.0.0 Safari/537.36
bot:
name: Cypress
category: Site Monitor
url: https://github.com/cypress-io/cypress
producer:
name: Cypress.io, Inc.
url: https://www.cypress.io/
-
user_agent: Google-Area120-PrivacyPolicyFetcher
bot:
Expand Down
18 changes: 0 additions & 18 deletions Tests/fixtures/podcasting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,24 +494,6 @@
model: ""
os_family: Unknown
browser_family: Unknown
-
user_agent: Android.LVLDM
os:
name: Android
version: ""
platform: ""
client:
type: browser
name: Android Browser
version: ""
engine: WebKit
engine_version: ""
device:
type: ""
brand: ""
model: ""
os_family: Android
browser_family: Android Browser
-
user_agent: PRDownloader
os: [ ]
Expand Down
8 changes: 0 additions & 8 deletions regexes/bots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4299,14 +4299,6 @@
name: 'Ghost Inspector, Inc.'
url: 'https://www.ghostinspector.com/'

- regex: 'Cypress/[\d.]+'
name: 'Cypress'
category: 'Site Monitor'
url: 'https://github.com/cypress-io/cypress'
producer:
name: 'Cypress.io, Inc.'
url: 'https://www.cypress.io/'

- regex: 'Google-Apps-Script'
name: 'Google Apps Script'
category: 'Service Agent'
Expand Down
2 changes: 1 addition & 1 deletion regexes/client/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3290,7 +3290,7 @@
version: '$1'

#Android Browser
- regex: '(?<! like )Android'
- regex: '(?<! like )Android(?!\.)'
name: 'Android Browser'
version: ''
engine:
Expand Down
23 changes: 20 additions & 3 deletions regexes/client/libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
###############

- regex: 'PhantomJS(?:/(\d+[.\d]+))?'
name: 'PhantomJS'
version: '$1'
url: 'https://phantomjs.org/'

- regex: 'IPinfoClient/.*/(\d+[.\d]+)'
name: 'IPinfo'
version: '$1'
Expand Down Expand Up @@ -71,7 +76,7 @@
url: 'https://azure.microsoft.com/en-us/products/data-factory/'

# Dart
- regex: 'Dart(?:/(\d+[.\d]+))?'
- regex: 'Dart/(\d+[.\d]+)'
name: 'Dart'
version: '$1'
url: 'https://dart.dev/'
Expand Down Expand Up @@ -124,6 +129,18 @@
version: '$1'
url: 'https://www.slimerjs.org/'

# Jaunt
- regex: 'Jaunt/(\d+[.\d]+)'
name: 'Jaunt'
version: '$1'
url: 'https://jaunt-api.com/'

# Cypress
- regex: 'Cypress/(\d+[.\d]+)'
name: 'Cypress'
version: '$1'
url: 'https://github.com/cypress-io/cypress'

- regex: 'Wget(?:/(\d+[.\d]+))?'
name: 'Wget'
version: '$1'
Expand Down Expand Up @@ -162,7 +179,7 @@
name: 'Java HTTP Client'
version: '$1'

- regex: 'Java(?:/?(\d+[.\d]+))?'
- regex: 'Java/?(\d+[.\d]+)'
name: 'Java'
version: '$1'

Expand Down Expand Up @@ -215,7 +232,7 @@
version: '$1'
url: 'https://github.com/lostisland/faraday'

- regex: '(?:Go-http-client|Go )/?(?:(\d+[.\d]+))?(?: package http)?'
- regex: '(?:Go-http-client|^Go )/?(?:(\d+[.\d]+))?(?: package http)?'
name: 'Go-http-client'
version: '$1'

Expand Down
2 changes: 1 addition & 1 deletion regexes/client/mobile_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2571,7 +2571,7 @@
version: '$1'

# Electron generic apps
- regex: ' (?!(?:AppleWebKit|brave|Franz|Mailspring|Notion|Basecamp|Evernote|catalyst|ramboxpro|BlueMail|BeakerBrowser|Dezor|TweakStyle|Colibri|Polypane|Singlebox|Skye|VibeMate|(?:d|LT|Glass|Sushi|Flash|OhHai)Browser|Sizzy))([a-z0-9]*)(?:-desktop|-electron-app)?/(\d+\.[\d.]+).*Electron/'
- regex: ' (?!(?:AppleWebKit|brave|Cypress|Franz|Mailspring|Notion|Basecamp|Evernote|catalyst|ramboxpro|BlueMail|BeakerBrowser|Dezor|TweakStyle|Colibri|Polypane|Singlebox|Skye|VibeMate|(?:d|LT|Glass|Sushi|Flash|OhHai)Browser|Sizzy))([a-z0-9]*)(?:-desktop|-electron-app)?/(\d+\.[\d.]+).*Electron/'
name: '$1'
version: '$2'

Expand Down

0 comments on commit 8ad6d49

Please sign in to comment.