Name | os-normalizer JSON |
Version |
0.3.2
JSON |
| download |
home_page | None |
Summary | Normalize raw OS strings/metadata into structured data (family, product, version, arch). |
upload_time | 2025-09-11 04:11:39 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.11 |
license | MIT License
Copyright (c) 2025 OS Normalizer contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
cpe
fingerprint
normalize
os
parsing
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# OS Normalizer
A Python library for identifying and parsing operating system information from various sources.
## Overview
The OS Normalizer library parses raw operating system strings and JSON data to identify the OS family, version, architecture, and other details. It supports parsing of:
- Windows (NT builds, versions)
- macOS (Darwin versions, codenames)
- Linux distributions (Ubuntu, Debian, Red Hat, etc.)
- iOS and Android mobile OS
- BSD variants (FreeBSD, OpenBSD, NetBSD)
- Network operating systems (Cisco IOS, Junos, FortiOS, etc.)
## Installation
```bash
pip install os-normalizer
```
## Usage
The main entry point is the `normalize_os` function, which takes a string and an optional data dictionary and returns a structured `OSData` result.
### Basic Usage
```python
from os_normalizer import normalize_os
# Parse the OS information
result = normalize_os("Windows NT 10.0 build 22631 Enterprise x64")
print(result.family) # windows
print(result.product) # Windows 11
print(result.version_major) # 11
```
### Using Raw OS JSON Data
```python
from os_normalizer import normalize_os
# Fingerprint with both raw string and JSON data
raw_os_string="Linux host 5.15.0-122-generic x86_64"
raw_os_json={
"os_release": 'NAME="Ubuntu"\nID=ubuntu\nVERSION_ID="22.04.4"\nVERSION_CODENAME=jammy\nPRETTY_NAME="Ubuntu 22.04.4 LTS"'}
result = normalize_os(raw_os_string, raw_os_json)
print(result.family) # linux
print(result.product) # Ubuntu
print(result.codename) # Jammy
print(result.arch) # x86_64
```
### Parsing Network Operating Systems
```python
from os_normalizer import normalize_os
# Parse Cisco IOS XE
raw_os_string="Cisco IOS XE Software, Version 17.9.4a (Amsterdam) C9300-24T, universalk9, c9300-universalk9.17.09.04a.SPA.bin"
result = normalize_os(raw_os_string)
print(result.family) # network-os
print(result.vendor) # Cisco
print(result.product) # IOS XE
```
## Models
### OSData
Represents structured operating system information:
- `family`: OS family (windows, linux, macos, ios, android, bsd, network-os)
- `vendor`: Vendor name (Microsoft, Apple, Cisco, etc.)
- `product`: Product name (Windows 11, Ubuntu, macOS, etc.)
- `edition`: Edition information (Pro, Enterprise, etc.)
- `codename`: Release codename (Sequoia, Ventura, etc.)
- `channel`: Release channel (GA, LTS, etc.)
- `version_major`, `version_minor`, `version_patch`, `version_build`: Version components
- `kernel_name`, `kernel_version`: Kernel details
- `arch`: Architecture (x86_64, arm64, etc.)
- `distro`: Distribution name
- `like_distros`: List of similar distributions
- `pretty_name`: Pretty formatted name
- `hw_model`, `build_id`: Network device details
- `precision`: Precision level (family, product, major, minor, patch, build)
- `confidence`: Confidence score (0.0 to 1.0)
- `evidence`: Evidence used for parsing decisions
- `os_key`: Canonical key for deduplication
## Architecture
The library follows a modular architecture:
- **os_normalizer.py**: Main orchestration logic that delegates to appropriate parsers
- **parsers/**: OS-specific parsers (macOS, Linux, Windows, Network, Mobile, BSD)
- **models.py**: Data models for parsed results
- **constants.py**: Static lookup tables (aliases, build maps, codenames)
- **helpers.py**: Utility functions (architecture extraction, confidence calculation)
## Testing
You can run tests with uv in a few ways:
- Ephemeral runner (downloads pytest if needed):
- `uvx pytest`
- Use the project environment and dev dependencies declared in `pyproject.toml`:
- `uv run --group dev pytest`
- Optional editable install for import paths:
- `uv pip install -e .`
- `uv run pytest`
### Using Nox (with nox-uv)
If you prefer repeatable sessions, this project includes Nox configured with the `nox-uv` plugin so virtualenvs are created via `uv`:
- Run tests: `uv run nox`
## Contributing
Contributions are welcome! Please ensure that any new parsers or improvements follow the existing code patterns and include appropriate tests.
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "os-normalizer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "cpe, fingerprint, normalize, os, parsing",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b7/f8/ef161eecfbc83a0d681c0fce569f4c982353fd385d50dd4b6c94d4dc5ed5/os_normalizer-0.3.2.tar.gz",
"platform": null,
"description": "# OS Normalizer\n\nA Python library for identifying and parsing operating system information from various sources.\n\n## Overview\n\nThe OS Normalizer library parses raw operating system strings and JSON data to identify the OS family, version, architecture, and other details. It supports parsing of:\n\n- Windows (NT builds, versions)\n- macOS (Darwin versions, codenames)\n- Linux distributions (Ubuntu, Debian, Red Hat, etc.)\n- iOS and Android mobile OS\n- BSD variants (FreeBSD, OpenBSD, NetBSD)\n- Network operating systems (Cisco IOS, Junos, FortiOS, etc.)\n\n## Installation\n\n```bash\npip install os-normalizer\n```\n\n## Usage\n\nThe main entry point is the `normalize_os` function, which takes a string and an optional data dictionary and returns a structured `OSData` result.\n\n### Basic Usage\n\n```python\nfrom os_normalizer import normalize_os\n\n# Parse the OS information\nresult = normalize_os(\"Windows NT 10.0 build 22631 Enterprise x64\")\nprint(result.family) # windows\nprint(result.product) # Windows 11\nprint(result.version_major) # 11\n```\n\n### Using Raw OS JSON Data\n\n```python\nfrom os_normalizer import normalize_os\n\n# Fingerprint with both raw string and JSON data\nraw_os_string=\"Linux host 5.15.0-122-generic x86_64\"\nraw_os_json={\n \"os_release\": 'NAME=\"Ubuntu\"\\nID=ubuntu\\nVERSION_ID=\"22.04.4\"\\nVERSION_CODENAME=jammy\\nPRETTY_NAME=\"Ubuntu 22.04.4 LTS\"'}\n\nresult = normalize_os(raw_os_string, raw_os_json)\nprint(result.family) # linux\nprint(result.product) # Ubuntu\nprint(result.codename) # Jammy\nprint(result.arch) # x86_64\n```\n\n### Parsing Network Operating Systems\n\n```python\nfrom os_normalizer import normalize_os\n\n# Parse Cisco IOS XE\nraw_os_string=\"Cisco IOS XE Software, Version 17.9.4a (Amsterdam) C9300-24T, universalk9, c9300-universalk9.17.09.04a.SPA.bin\"\n\nresult = normalize_os(raw_os_string)\nprint(result.family) # network-os\nprint(result.vendor) # Cisco\nprint(result.product) # IOS XE\n```\n\n## Models\n\n### OSData\n\nRepresents structured operating system information:\n\n- `family`: OS family (windows, linux, macos, ios, android, bsd, network-os)\n- `vendor`: Vendor name (Microsoft, Apple, Cisco, etc.)\n- `product`: Product name (Windows 11, Ubuntu, macOS, etc.)\n- `edition`: Edition information (Pro, Enterprise, etc.)\n- `codename`: Release codename (Sequoia, Ventura, etc.)\n- `channel`: Release channel (GA, LTS, etc.)\n- `version_major`, `version_minor`, `version_patch`, `version_build`: Version components\n- `kernel_name`, `kernel_version`: Kernel details\n- `arch`: Architecture (x86_64, arm64, etc.)\n- `distro`: Distribution name\n- `like_distros`: List of similar distributions\n- `pretty_name`: Pretty formatted name\n- `hw_model`, `build_id`: Network device details\n- `precision`: Precision level (family, product, major, minor, patch, build)\n- `confidence`: Confidence score (0.0 to 1.0)\n- `evidence`: Evidence used for parsing decisions\n- `os_key`: Canonical key for deduplication\n\n## Architecture\n\nThe library follows a modular architecture:\n\n- **os_normalizer.py**: Main orchestration logic that delegates to appropriate parsers\n- **parsers/**: OS-specific parsers (macOS, Linux, Windows, Network, Mobile, BSD)\n- **models.py**: Data models for parsed results\n- **constants.py**: Static lookup tables (aliases, build maps, codenames)\n- **helpers.py**: Utility functions (architecture extraction, confidence calculation)\n\n## Testing\n\nYou can run tests with uv in a few ways:\n\n- Ephemeral runner (downloads pytest if needed):\n - `uvx pytest`\n- Use the project environment and dev dependencies declared in `pyproject.toml`:\n - `uv run --group dev pytest`\n- Optional editable install for import paths:\n - `uv pip install -e .`\n - `uv run pytest`\n\n### Using Nox (with nox-uv)\n\nIf you prefer repeatable sessions, this project includes Nox configured with the `nox-uv` plugin so virtualenvs are created via `uv`:\n\n- Run tests: `uv run nox`\n\n## Contributing\n\nContributions are welcome! Please ensure that any new parsers or improvements follow the existing code patterns and include appropriate tests.\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 OS Normalizer contributors\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "Normalize raw OS strings/metadata into structured data (family, product, version, arch).",
"version": "0.3.2",
"project_urls": {
"Changelog": "https://github.com/johnscillieri/os-normalizer/releases",
"Homepage": "https://github.com/johnscillieri/os-normalizer",
"Issues": "https://github.com/johnscillieri/os-normalizer/issues",
"Repository": "https://github.com/johnscillieri/os-normalizer"
},
"split_keywords": [
"cpe",
" fingerprint",
" normalize",
" os",
" parsing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8f6d8c7a9787c73f65bace5130b7ba93e5172b17ce72194c6e2dbeaf75ff8e29",
"md5": "0d3778bfe5e9452cef6a6ed40b13f305",
"sha256": "470d863631ce9927e9d9ba37e6076b7f14a9ed39462b7829ad04c385feab94ac"
},
"downloads": -1,
"filename": "os_normalizer-0.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d3778bfe5e9452cef6a6ed40b13f305",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 28348,
"upload_time": "2025-09-11T04:11:37",
"upload_time_iso_8601": "2025-09-11T04:11:37.876979Z",
"url": "https://files.pythonhosted.org/packages/8f/6d/8c7a9787c73f65bace5130b7ba93e5172b17ce72194c6e2dbeaf75ff8e29/os_normalizer-0.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b7f8ef161eecfbc83a0d681c0fce569f4c982353fd385d50dd4b6c94d4dc5ed5",
"md5": "bf6e6ba815919f52c28b67088e67fb67",
"sha256": "2cacf22ac7894b2a2e66c2de3e238688cd0f0a46df2464e1c4996d2c536a2980"
},
"downloads": -1,
"filename": "os_normalizer-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "bf6e6ba815919f52c28b67088e67fb67",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 21080,
"upload_time": "2025-09-11T04:11:39",
"upload_time_iso_8601": "2025-09-11T04:11:39.054329Z",
"url": "https://files.pythonhosted.org/packages/b7/f8/ef161eecfbc83a0d681c0fce569f4c982353fd385d50dd4b6c94d4dc5ed5/os_normalizer-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-11 04:11:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "johnscillieri",
"github_project": "os-normalizer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "os-normalizer"
}