Confusable Homoglyphs (version 3.3.1) is a Python library designed to detect and prevent homograph attacks by identifying visually similar Unicode characters (homoglyphs). It provides functionality to check for mixed-script strings and characters that might be confused with others from a preferred set of Unicode blocks. The library is actively maintained with regular updates to its underlying Unicode data and Python compatibility, aiming to safeguard against visual deception in text.
pip install confusable-homoglyphsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `is_dangerous` to detect strings with mixed scripts and characters that could be confused with a preferred alias (e.g., 'latin'), and `is_confusable` to find all confusable characters within a string.
Upgrade Python to version 3.7 or later.
Adjust code to expect a boolean return value from `is_dangerous()`.
Consider using the `cli` bundle to manually update data files for the latest Unicode definitions, though the distributed data is kept current by maintainers.
Initialize `confusables` object once, e.g., `from confusable_homoglyphs import confusables` at the module level or within an application's startup, and reuse its functions.
Verify import statements (e.g., `from confusable_homoglyphs import confusables`) to confirm you are using the intended library.
pip install confusable-homoglyphs
from confusable_homoglyphs import confusables
Adjust your code to expect a boolean return value from `is_dangerous()`. If you need a list of confusable characters, use `confusables.is_confusable(string, greedy=True)` instead.
Upgrade your Python environment to version 3.7 or later.
No dependency data recorded yet.