Skip to main content

font-obfuscator

项目简介

字体混淆工具是一个开源的 Python 库,旨在通过混淆字体文件中的字符到字形映射,防止网页内容被爬虫轻松提取。该工具允许您在 TrueType Font (TTF) 文件中打乱或加密字符映射,从而增加网站文本的安全性。

功能特点

  • 字符混淆: 打乱或加密 TTF 字体文件中的字符到字形映射。
  • 字符集筛选: 只保留字体文件中的指定字符,移除所有其他字符。
  • 易于集成: 作为独立的 Python 函数使用,可集成到现有项目中。

环境要求

Python 3.10+ FontTools

安装步骤

pip install font-obfuscator

使用方法

###基本示例

from font_obfuscator import obfuscator_text

test_text = "这是一段测试文本"
obf_text, obf_io = obfuscator_text(test_text)

print(f"Origin Text: {test_text}")
print(f"Obf Text: {obf_text}")
print(f"Obf Font: {obf_io}")
test_html = """
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Custom Font Example</title>
    <style>
        @font-face {
            font-family: 'ShuffledFont';
            src: url('data:font/ttf;base64,ObfFont') format('truetype');
        }
        .custom-font {
            font-family: 'ShuffledFont';
        }
    </style>
</head>
<body>
    <h1 class="custom-font">ObfText</h1>
</body>
</html>
""".replace("ObfFont", obf_io).replace("ObfText", obf_text)
print(test_html)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

font_obfuscator-0.1.2.tar.gz (11.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

font_obfuscator-0.1.2-py3-none-any.whl (11.3 MB view details)

Uploaded Python 3

File details

Details for the file font_obfuscator-0.1.2.tar.gz.

File metadata

  • Download URL: font_obfuscator-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.8 Darwin/23.5.0

File hashes

Hashes for font_obfuscator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0e6e21dd8327ce006a0406091021e7ac1563f3bda63bf2ac242992fd95558ef4
MD5 cbe1d083b25efe2f072e8a9d6e4490d7
BLAKE2b-256 ad6cc5147f23c72ba923686d7f5f7fccaafea17a1faa10bbed53991e780816e7

See more details on using hashes here.

File details

Details for the file font_obfuscator-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: font_obfuscator-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.8 Darwin/23.5.0

File hashes

Hashes for font_obfuscator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa2f4637bac26dca3305a75c0e509f44f3a957c93864c0f7246dff9d20c07390
MD5 259c4e0e70cc6c68baa3d4dd5c173847
BLAKE2b-256 36c077010ebe65a32b360e28144788f007a376222405e41d6b3cdf978ec67d1b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page