From 2a7f8f064d4311028582d70f58aae1fd9ae49e51 Mon Sep 17 00:00:00 2001 From: Dima Alexeenko Date: Mon, 9 Sep 2024 15:56:47 +0300 Subject: [PATCH 1/4] feat: add new iOS versions --- regexes.yaml | 46 ++++++++++++++++++++++++++++++ tests/test_os.yaml | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/regexes.yaml b/regexes.yaml index 856fbc1e..da915972 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1692,9 +1692,55 @@ os_parsers: os_replacement: 'iOS' os_v1_replacement: '16' os_v2_replacement: '4' + - regex: 'CFNetwork/.{0,100} Darwin/22\.5\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '16' + os_v2_replacement: '5' - regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+' os_replacement: 'iOS' os_v1_replacement: '16' + - regex: 'CFNetwork/.{0,100} Darwin/23\.0\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '0' + - regex: 'CFNetwork/.{0,100} Darwin/23\.1\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '1' + - regex: 'CFNetwork/.{0,100} Darwin/23\.2\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '2' + - regex: 'CFNetwork/.{0,100} Darwin/23\.3\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '3' + - regex: 'CFNetwork/.{0,100} Darwin/23\.4\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '4' + - regex: 'CFNetwork/.{0,100} Darwin/23\.5\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '5' + - regex: 'CFNetwork/.{0,100} Darwin/23\.6\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + os_v2_replacement: '6' + - regex: 'CFNetwork/.{0,100} Darwin/(23)\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '17' + - regex: 'CFNetwork/.{0,100} Darwin/24\.0\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '18' + os_v2_replacement: '0' + - regex: 'CFNetwork/.{0,100} Darwin/24\.1\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '18' + os_v2_replacement: '1' + - regex: 'CFNetwork/.{0,100} Darwin/(24)\.\d+' + os_replacement: 'iOS' + os_v1_replacement: '18' - regex: 'CFNetwork/.{0,100} Darwin/' os_replacement: 'iOS' diff --git a/tests/test_os.yaml b/tests/test_os.yaml index 77b10bbf..dae3e469 100644 --- a/tests/test_os.yaml +++ b/tests/test_os.yaml @@ -2460,6 +2460,76 @@ test_cases: patch: patch_minor: + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/22.5.0' + family: 'iOS' + major: '16' + minor: '5' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.0.0' + family: 'iOS' + major: '17' + minor: '0' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.1.0' + family: 'iOS' + major: '17' + minor: '1' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.2.0' + family: 'iOS' + major: '17' + minor: '2' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.3.0' + family: 'iOS' + major: '17' + minor: '3' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.4.0' + family: 'iOS' + major: '17' + minor: '4' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.5.0' + family: 'iOS' + major: '17' + minor: '5' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.6.0' + family: 'iOS' + major: '17' + minor: '6' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/24.0.0' + family: 'iOS' + major: '18' + minor: '0' + patch: + patch_minor: + + - user_agent_string: 'App/0 CFNetwork/1442 Darwin/24.1.0' + family: 'iOS' + major: '18' + minor: '1' + patch: + patch_minor: + - user_agent_string: 'Mozilla/5.0 (iPhone; CPU 7_0_6 like Mac OS X; en_GB) AppleWebKit (KHTML, like Gecko) Mobile [OKMagazine/4.0.1 (iOS/7.0.6)] [LiteApps]' family: 'iOS' major: '7' From a5c720e05c542bc3ba48e259aa10eb45549b906d Mon Sep 17 00:00:00 2001 From: Dima Alexeenko Date: Mon, 23 Sep 2024 15:57:21 +0300 Subject: [PATCH 2/4] get minor part from Darwin minor --- regexes.yaml | 60 ++++++---------------------------------------------- 1 file changed, 6 insertions(+), 54 deletions(-) diff --git a/regexes.yaml b/regexes.yaml index da915972..242ce9b2 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1672,72 +1672,24 @@ os_parsers: - regex: 'CFNetwork/.{0,100} Darwin/(21)\.\d+' os_replacement: 'iOS' os_v1_replacement: '15' - - regex: 'CFNetwork/.{0,100} Darwin/22\.0\.\d+' + - regex: 'CFNetwork/.{0,100} Darwin/22\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '16' - os_v2_replacement: '0' - - regex: 'CFNetwork/.{0,100} Darwin/22\.1\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '16' - os_v2_replacement: '1' - - regex: 'CFNetwork/.{0,100} Darwin/22\.2\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '16' - os_v2_replacement: '2' - - regex: 'CFNetwork/.{0,100} Darwin/22\.3\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '16' - os_v2_replacement: '3' - - regex: 'CFNetwork/.{0,100} Darwin/22\.4\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '16' - os_v2_replacement: '4' - - regex: 'CFNetwork/.{0,100} Darwin/22\.5\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '16' - os_v2_replacement: '5' + os_v2_replacement: '$2' - regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+' os_replacement: 'iOS' os_v1_replacement: '16' - - regex: 'CFNetwork/.{0,100} Darwin/23\.0\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '0' - - regex: 'CFNetwork/.{0,100} Darwin/23\.1\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '1' - - regex: 'CFNetwork/.{0,100} Darwin/23\.2\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '2' - - regex: 'CFNetwork/.{0,100} Darwin/23\.3\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '3' - - regex: 'CFNetwork/.{0,100} Darwin/23\.4\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '4' - - regex: 'CFNetwork/.{0,100} Darwin/23\.5\.\d+' + - regex: 'CFNetwork/.{0,100} Darwin/23\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '17' - os_v2_replacement: '5' - - regex: 'CFNetwork/.{0,100} Darwin/23\.6\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '17' - os_v2_replacement: '6' + os_v2_replacement: '$2' - regex: 'CFNetwork/.{0,100} Darwin/(23)\.\d+' os_replacement: 'iOS' os_v1_replacement: '17' - - regex: 'CFNetwork/.{0,100} Darwin/24\.0\.\d+' + - regex: 'CFNetwork/.{0,100} Darwin/24\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '18' - os_v2_replacement: '0' - - regex: 'CFNetwork/.{0,100} Darwin/24\.1\.\d+' - os_replacement: 'iOS' - os_v1_replacement: '18' - os_v2_replacement: '1' + os_v2_replacement: '$2' - regex: 'CFNetwork/.{0,100} Darwin/(24)\.\d+' os_replacement: 'iOS' os_v1_replacement: '18' From 59284301640f5aeac66d694d351ca7b7bc61aa1d Mon Sep 17 00:00:00 2001 From: Dima Alexeenko Date: Mon, 23 Sep 2024 15:58:27 +0300 Subject: [PATCH 3/4] delete wrong test case --- tests/test_os.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/test_os.yaml b/tests/test_os.yaml index dae3e469..46705298 100644 --- a/tests/test_os.yaml +++ b/tests/test_os.yaml @@ -2509,13 +2509,6 @@ test_cases: patch: patch_minor: - - user_agent_string: 'App/0 CFNetwork/1442 Darwin/23.6.0' - family: 'iOS' - major: '17' - minor: '6' - patch: - patch_minor: - - user_agent_string: 'App/0 CFNetwork/1442 Darwin/24.0.0' family: 'iOS' major: '18' From 8b752871d4690109f47d438b0afa8a4690f62079 Mon Sep 17 00:00:00 2001 From: Dima Alexeenko Date: Fri, 27 Sep 2024 11:04:18 +0300 Subject: [PATCH 4/4] wrong match group --- regexes.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/regexes.yaml b/regexes.yaml index 242ce9b2..b0246686 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1675,21 +1675,21 @@ os_parsers: - regex: 'CFNetwork/.{0,100} Darwin/22\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '16' - os_v2_replacement: '$2' + os_v2_replacement: '$1' - regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+' os_replacement: 'iOS' os_v1_replacement: '16' - regex: 'CFNetwork/.{0,100} Darwin/23\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '17' - os_v2_replacement: '$2' + os_v2_replacement: '$1' - regex: 'CFNetwork/.{0,100} Darwin/(23)\.\d+' os_replacement: 'iOS' os_v1_replacement: '17' - regex: 'CFNetwork/.{0,100} Darwin/24\.([0-5])\.\d+' os_replacement: 'iOS' os_v1_replacement: '18' - os_v2_replacement: '$2' + os_v2_replacement: '$1' - regex: 'CFNetwork/.{0,100} Darwin/(24)\.\d+' os_replacement: 'iOS' os_v1_replacement: '18'