os-normalizer 0.3.3__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of os-normalizer might be problematic. Click here for more details.
- os_normalizer/parsers/windows.py +21 -9
- {os_normalizer-0.3.3.dist-info → os_normalizer-0.4.0.dist-info}/METADATA +1 -1
- {os_normalizer-0.3.3.dist-info → os_normalizer-0.4.0.dist-info}/RECORD +5 -5
- {os_normalizer-0.3.3.dist-info → os_normalizer-0.4.0.dist-info}/WHEEL +0 -0
- {os_normalizer-0.3.3.dist-info → os_normalizer-0.4.0.dist-info}/licenses/LICENSE +0 -0
os_normalizer/parsers/windows.py
CHANGED
|
@@ -26,6 +26,7 @@ WIN_SP_RE = re.compile(r"\bSP\s?([0-9]+)\b", re.IGNORECASE)
|
|
|
26
26
|
WIN_BUILD_RE = re.compile(r"\bbuild\s?(\d{4,6})\b", re.IGNORECASE)
|
|
27
27
|
WIN_NT_RE = re.compile(r"\bnt\s?(\d+)\.(\d+)\b", re.IGNORECASE)
|
|
28
28
|
WIN_FULL_NT_BUILD_RE = re.compile(r"\b(10)\.(0)\.(\d+)(?:\.(\d+))?\b")
|
|
29
|
+
WIN_GENERIC_VERSION_RE = re.compile(r"\b(\d+)\.(\d+)\.(\d{3,6})(?:\.(\d+))?\b")
|
|
29
30
|
WIN_CHANNEL_RE = re.compile(
|
|
30
31
|
r"\b(24H2|23H2|22H2|21H2|21H1|20H2|2004|1909|1903|1809|1803|1709|1703|1607|1511|1507)\b",
|
|
31
32
|
re.IGNORECASE,
|
|
@@ -63,6 +64,9 @@ def parse_windows(text: str, data: dict[str, Any], p: OSData) -> OSData:
|
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
def _detect_product_from_text(t: str) -> str:
|
|
67
|
+
# Normalize common typos before matching
|
|
68
|
+
t = t.replace("windws", "windows")
|
|
69
|
+
|
|
66
70
|
if "windows 11" in t or "win11" in t:
|
|
67
71
|
return "Windows 11"
|
|
68
72
|
if "windows 10" in t or "win10" in t:
|
|
@@ -79,23 +83,23 @@ def _detect_product_from_text(t: str) -> str:
|
|
|
79
83
|
return "Windows 98"
|
|
80
84
|
|
|
81
85
|
# Server explicit names
|
|
82
|
-
if "windows server 2012 r2" in t:
|
|
86
|
+
if "windows server 2012 r2" in t or "windows 2012 r2" in t or "win2k12r2" in t or "win2012r2" in t:
|
|
83
87
|
return "Windows Server 2012 R2"
|
|
84
|
-
if "windows server 2022" in t or "win2k22" in t or "win2022" in t:
|
|
88
|
+
if "windows server 2022" in t or "windows 2022" in t or "win2k22" in t or "win2022" in t:
|
|
85
89
|
return "Windows Server 2022"
|
|
86
|
-
if "windows server 2019" in t or "win2k19" in t or "win2019" in t:
|
|
90
|
+
if "windows server 2019" in t or "windows 2019" in t or "win2k19" in t or "win2019" in t:
|
|
87
91
|
return "Windows Server 2019"
|
|
88
|
-
if "windows server 2016" in t or "win2k16" in t or "win2016" in t:
|
|
92
|
+
if "windows server 2016" in t or "windows 2016" in t or "win2k16" in t or "win2016" in t:
|
|
89
93
|
return "Windows Server 2016"
|
|
90
|
-
if "windows server 2012" in t or "win2k12" in t or "win2012" in t:
|
|
94
|
+
if "windows server 2012" in t or "windows 2012" in t or "win2k12" in t or "win2012" in t:
|
|
91
95
|
return "Windows Server 2012"
|
|
92
|
-
if "windows server 2008 r2" in t:
|
|
96
|
+
if "windows server 2008 r2" in t or "windows 2008 r2" in t or "win2k8r2" in t or "win2008r2" in t:
|
|
93
97
|
return "Windows Server 2008 R2"
|
|
94
|
-
if "windows server 2008" in t or "win2k8" in t or "win2008" in t:
|
|
98
|
+
if "windows server 2008" in t or "windows 2008" in t or "win2k8" in t or "win2008" in t:
|
|
95
99
|
return "Windows Server 2008"
|
|
96
|
-
if "windows server 2003" in t or "win2k3" in t or "win2003" in t:
|
|
100
|
+
if "windows server 2003" in t or "windows 2003" in t or "win2k3" in t or "win2003" in t:
|
|
97
101
|
return "Windows Server 2003"
|
|
98
|
-
if "windows server 2000" in t or "win2k" in t or "win2000" in t:
|
|
102
|
+
if "windows server 2000" in t or "windows 2000" in t or "win2k" in t or "win2000" in t:
|
|
99
103
|
return "Windows Server 2000"
|
|
100
104
|
|
|
101
105
|
if "windows" in t:
|
|
@@ -214,6 +218,14 @@ def _apply_full_kernel_and_channel(text: str, p: OSData) -> None:
|
|
|
214
218
|
if ch and not p.channel:
|
|
215
219
|
p.channel = ch.group(1).upper()
|
|
216
220
|
|
|
221
|
+
if not p.kernel_version:
|
|
222
|
+
m2 = WIN_GENERIC_VERSION_RE.search(text)
|
|
223
|
+
if m2:
|
|
224
|
+
major, minor, build, suffix = m2.groups()
|
|
225
|
+
p.kernel_version = f"{major}.{minor}.{build}{('.' + suffix) if suffix else ''}"
|
|
226
|
+
p.version_build = p.version_build or build
|
|
227
|
+
p.evidence.setdefault("nt_version", f"{major}.{minor}")
|
|
228
|
+
|
|
217
229
|
|
|
218
230
|
def _finalize_precision_and_version(p: OSData) -> None:
|
|
219
231
|
if p.version_build:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: os-normalizer
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Normalize raw OS strings/metadata into structured data (family, product, version, arch).
|
|
5
5
|
Project-URL: Homepage, https://github.com/johnscillieri/os-normalizer
|
|
6
6
|
Project-URL: Repository, https://github.com/johnscillieri/os-normalizer
|
|
@@ -9,14 +9,14 @@ os_normalizer/parsers/bsd.py,sha256=Umm7RSXjQfv6pfziJ8BYlmOc80VlLRueTrYw1iR-UjY,
|
|
|
9
9
|
os_normalizer/parsers/linux.py,sha256=kSIYZ_hRJxJieV21u8TRcWfAjYOIXlCLBSwyINkuyA4,3867
|
|
10
10
|
os_normalizer/parsers/macos.py,sha256=fU1YyiijzBdDAxUBSL2EQLhUu3JbOSx-N_KYvOg0XsI,3627
|
|
11
11
|
os_normalizer/parsers/mobile.py,sha256=Ca864JhrO9zW5fs0zbs2VcMypKIkFHqZtxpJDbi12q0,1033
|
|
12
|
-
os_normalizer/parsers/windows.py,sha256=
|
|
12
|
+
os_normalizer/parsers/windows.py,sha256=2nIRMz98f2MBMKSjhVPU4nNwTlsvKBVxyacDTV4Nj10,8792
|
|
13
13
|
os_normalizer/parsers/network/__init__.py,sha256=TvRz08lNDZbr6yG8O3M7cLNu0hWAbtE1y7_9SwhP4g4,1596
|
|
14
14
|
os_normalizer/parsers/network/cisco.py,sha256=ivhw85IHnHVT4sW-65F-ZGCR7yvu0mMMBfXRT4EzUfc,3203
|
|
15
15
|
os_normalizer/parsers/network/fortinet.py,sha256=i6PVRxzO_onaCvo3_eI4csXFwGp4ZpQY0d1y2-Wodn0,1783
|
|
16
16
|
os_normalizer/parsers/network/huawei.py,sha256=Su3eCRlmOCmpOPA_TGeH8gHY3-ZdXKFW4O3_W0SOPmk,1158
|
|
17
17
|
os_normalizer/parsers/network/juniper.py,sha256=gskbaY4-LYWauM9yrvGMuCxPrNBKmUfIRPd1zsUUY7w,1275
|
|
18
18
|
os_normalizer/parsers/network/netgear.py,sha256=idVD7VTxb07LdhFPwb-sT3586ARoBrd1OmWpADAZUVc,1190
|
|
19
|
-
os_normalizer-0.
|
|
20
|
-
os_normalizer-0.
|
|
21
|
-
os_normalizer-0.
|
|
22
|
-
os_normalizer-0.
|
|
19
|
+
os_normalizer-0.4.0.dist-info/METADATA,sha256=-HlNH57xDmctT1Ul8K4wB5598EC0-1GaJgv-h3zSuAo,6421
|
|
20
|
+
os_normalizer-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
21
|
+
os_normalizer-0.4.0.dist-info/licenses/LICENSE,sha256=DN0enoiHxVkJ-hxmIchPaCQWrDsZwva5LY8XvG3UK8w,1083
|
|
22
|
+
os_normalizer-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|