Skip to content

Commit

Permalink
Adds detection for Alpine Linux, AOSC OS, Clear Linux OS, EulerOS, Lo…
Browse files Browse the repository at this point in the history
…ongnix, Rocky Linux, Scientific Linux and improves version detection for CentOS, Debian, iPadOS, macOS, Red Hat, SUSE and Windows (#7654)

* Improves version detection for macOS
* Improves version detection for macOS
* Improves version detection for Windows
* Adds detection for LoongArch64
* Adds detection for AOSC OS
* Adds detection for Loongnix
* Adds detection for EulerOS
* Adds detection for Scientific Linux
* Adds detection for Alpine Linux
* Adds detection for Clear Linux OS
* Adds detection for Rocky Linux
* Improves version detection for CentOS
* Improves version detection for Debian
* Improves detection for Red Hat
* Improves detection for SUSE
* Improves detection for iPadOS
---------

Co-authored-by: Tutik Alexsandr <[email protected]>
  • Loading branch information
liviuconcioiu and sanchezzzhak committed Apr 12, 2024
1 parent dbf040a commit 35ab058
Show file tree
Hide file tree
Showing 3 changed files with 308 additions and 11 deletions.
18 changes: 17 additions & 1 deletion Parser/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ class OperatingSystem extends AbstractParser
'AIX' => 'AIX',
'AND' => 'Android',
'ADR' => 'Android TV',
'ALP' => 'Alpine Linux',
'AMZ' => 'Amazon Linux',
'AMG' => 'AmigaOS',
'ARM' => 'Armadillo OS',
'ATV' => 'tvOS',
'ARL' => 'Arch Linux',
'AOS' => 'AOSC OS',
'ASP' => 'ASPLinux',
'BTR' => 'BackTrack',
'SBA' => 'Bada',
Expand All @@ -60,6 +62,7 @@ class OperatingSystem extends AbstractParser
'CAI' => 'Caixa Mágica',
'CES' => 'CentOS',
'CST' => 'CentOS Stream',
'CLO' => 'Clear Linux OS',
'CLR' => 'ClearOS Mobile',
'COS' => 'Chrome OS',
'CRS' => 'Chromium OS',
Expand All @@ -70,6 +73,7 @@ class OperatingSystem extends AbstractParser
'DFB' => 'DragonFly',
'DVK' => 'DVKBuntu',
'ELE' => 'ElectroBSD',
'EUL' => 'EulerOS',
'FED' => 'Fedora',
'FEN' => 'Fenix',
'FOS' => 'Firefox OS',
Expand Down Expand Up @@ -103,6 +107,7 @@ class OperatingSystem extends AbstractParser
'LNS' => 'Linspire',
'LEN' => 'Lineage OS',
'LIR' => 'Liri OS',
'LOO' => 'Loongnix',
'LBT' => 'Lubuntu',
'LOS' => 'Lumin OS',
'LUN' => 'LuneOS',
Expand Down Expand Up @@ -143,6 +148,7 @@ class OperatingSystem extends AbstractParser
'RED' => 'RedOS',
'REV' => 'Revenge OS',
'ROS' => 'RISC OS',
'ROC' => 'Rocky Linux',
'ROK' => 'Roku OS',
'RSO' => 'Rosa',
'ROU' => 'RouterOS',
Expand All @@ -153,6 +159,7 @@ class OperatingSystem extends AbstractParser
'SAB' => 'Sabayon',
'SSE' => 'SUSE',
'SAF' => 'Sailfish OS',
'SCI' => 'Scientific Linux',
'SEE' => 'SeewoOS',
'SER' => 'SerenityOS',
'SIR' => 'Sirin OS',
Expand Down Expand Up @@ -222,7 +229,8 @@ class OperatingSystem extends AbstractParser
'LOS', 'DVK', 'ROK', 'OWR', 'OTV', 'KTV', 'PUR', 'PLA', 'FUC', 'PAR',
'FOR', 'MON', 'KAN', 'ZEN', 'LND', 'LNS', 'CHN', 'AMZ', 'TEN', 'CST',
'NOV', 'ROU', 'ZOR', 'RED', 'KAL', 'ORA', 'VID', 'TIV', 'BSN', 'RAS',
'UOS', 'PIO', 'FRI', 'LIR', 'WEB', 'SER', 'ASP',
'UOS', 'PIO', 'FRI', 'LIR', 'WEB', 'SER', 'ASP', 'AOS', 'LOO', 'EUL',
'SCI', 'ALP', 'CLO', 'ROC',
],
'Mac' => ['MAC'],
'Mobile Gaming Console' => ['PSP', 'NDS', 'XBX'],
Expand Down Expand Up @@ -630,6 +638,10 @@ protected function parsePlatform(): string
return 'ARM';
}

if (false !== \strpos($arch, 'loongarch64')) {
return 'LoongArch64';
}

if (false !== \strpos($arch, 'mips')) {
return 'MIPS';
}
Expand Down Expand Up @@ -657,6 +669,10 @@ protected function parsePlatform(): string
return 'ARM';
}

if ($this->matchUserAgent('loongarch64')) {
return 'LoongArch64';
}

if ($this->matchUserAgent('mips')) {
return 'MIPS';
}
Expand Down
192 changes: 192 additions & 0 deletions Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4686,3 +4686,195 @@
version: "13"
platform: ""
family: Android
-
user_agent: conda/23.5.0 requests/2.29.0 CPython/3.10.11 Darwin/22.5.0 OSX/13.4
os:
name: Mac
short_name: MAC
version: "13.4"
platform: ""
family: Mac
-
user_agent: python-requests/2.2.1 CPython/2.7.5 Darwin/13.1.0
os:
name: Mac
short_name: MAC
version: 10.9.2
platform: ""
family: Mac
-
user_agent: Boto3/1.17.18 Python/3.8.5 Darwin/19.6.0 Botocore/1.20.18
os:
name: Mac
short_name: MAC
version: 10.15.6
platform: ""
family: Mac
-
user_agent: python-requests/2.6.0 CPython/3.8.9 Windows/10
os:
name: Windows
short_name: WIN
version: "10"
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.18 Windows/8.1
os:
name: Windows
short_name: WIN
version: "8.1"
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.18 Windows/7
os:
name: Windows
short_name: WIN
version: "7"
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.0 Windows/2003Server
os:
name: Windows
short_name: WIN
version: Server 2003
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.9 Windows/2012Server
os:
name: Windows
short_name: WIN
version: Server 2012
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.18 Windows/2012ServerR2
os:
name: Windows
short_name: WIN
version: Server 2012 R2
platform: ""
family: Windows
-
user_agent: python-requests/2.7.0 CPython/2.7.18 Windows/2008ServerR2
os:
name: Windows
short_name: WIN
version: Server 2008 R2
platform: ""
family: Windows
-
user_agent: Mozilla/5.0 (X11; AOSC OS; Linux loongarch64; rv:120.0) Gecko/20100101 Firefox/120.0
os:
name: AOSC OS
short_name: AOS
version: ""
platform: LoongArch64
family: GNU/Linux
-
user_agent: conda/22.9.0 requests/2.26.0 CPython/3.8.6 Linux/4.19.190-6.2.4.lns8.loongarch64 loongnix-server/8.4.0 glibc/2.28
os:
name: Loongnix
short_name: LOO
version: 8.4.0
platform: LoongArch64
family: GNU/Linux
-
user_agent: conda/4.8.2 requests/2.22.0 CPython/3.7.6 Linux/4.18.0-147.5.1.6.h841.eulerosv2r9.x86_64 ubuntu/18.04.6 glibc/2.27
os:
name: EulerOS
short_name: EUL
version: "2.9"
platform: x64
family: GNU/Linux
-
user_agent: conda/4.6.14 requests/2.21.0 CPython/3.7.3 Linux/3.10.0-957.12.1.el7.x86_64 scientific/7.6 glibc/2.17
os:
name: Scientific Linux
short_name: SCI
version: "7.6"
platform: x64
family: GNU/Linux
-
user_agent: conda/4.8.2 requests/2.22.0 CPython/3.7.6 Linux/5.4.46-1-lts alpine/3.9.5 glibc/2.28
os:
name: Alpine Linux
short_name: ALP
version: 3.9.5
platform: ""
family: GNU/Linux
-
user_agent: conda/4.11.0 requests/2.28.1 CPython/3.10.6 Linux/5.19.1-1175.native clear-linux-os/36820 glibc/2.36
os:
name: Clear Linux OS
short_name: CLO
version: "36820"
platform: ""
family: GNU/Linux
-
user_agent: conda/23.5.0 requests/2.31.0 CPython/3.9.16 Linux/5.14.0-162.23.1.el9_1.x86_64 rocky/9.1 glibc/2.34
os:
name: Rocky Linux
short_name: ROC
version: "9.1"
platform: x64
family: GNU/Linux
-
user_agent: conda/4.10.3 requests/2.26.0 CPython/3.9.7 Linux/3.10.0-1160.53.1.el7.x86_64 centos/7.9.2009 glibc/2.17
os:
name: CentOS
short_name: CES
version: 7.9.2009
platform: x64
family: GNU/Linux
-
user_agent: conda/4.3.27 requests/2.18.4 CPython/2.7.13 Linux/3.10.0-957.27.2.el7.x86_64 CentOS Linux/7.6.1810 glibc/2.17
os:
name: CentOS
short_name: CES
version: 7.6.1810
platform: x64
family: GNU/Linux
-
user_agent: conda/4.3.31 requests/2.18.4 CPython/2.7.14 Linux/4.4.0-109-generic debian/stretch/sid glibc/2.23
os:
name: Debian
short_name: DEB
version: "9.13"
platform: ""
family: GNU/Linux
-
user_agent: conda/4.5.11 requests/2.18.4 CPython/3.6.4 Linux/2.6.32-696.20.1.el6.x86_64 rhel/6.9 glibc/2.12
os:
name: Red Hat
short_name: RHT
version: "6.9"
platform: x64
family: GNU/Linux
-
user_agent: conda/4.3.24 requests/2.14.2 CPython/3.6.1 Linux/3.10.0-514.el7.x86_64 Red Hat Enterprise Linux Server/7.3 glibc/2.17
os:
name: Red Hat
short_name: RHT
version: "7.3"
platform: x64
family: GNU/Linux
-
user_agent: conda/4.4.10 requests/2.18.4 CPython/3.6.4 Linux/4.4.114-94.14-default sles/12.3 glibc/2.22
os:
name: SUSE
short_name: SSE
version: "12.3"
platform: ""
family: GNU/Linux
-
user_agent: Pinterest for iOS/12.3 (iPad11,6; 17.2)
os:
name: iPadOS
short_name: IPA
version: "17.2"
platform: ""
family: iOS
Loading

0 comments on commit 35ab058

Please sign in to comment.