Skip to main content

Python bindings for observer-ward

Project description

observer-ward-py

Python绑定库,用于web技术指纹识别。这是ObserverWard项目中observer-ward库的Python接口。

安装

用法

基本用法

import os
from observer_ward import ObserverWard

with open('examples/test_fingerprints.json', 'r') as f:
    content = f.read()

# 初始化ObserverWard对象
# 不提供参数时,会尝试从默认位置加载指纹库
observer_ward = ObserverWard(content)

# 从HTML内容识别web技术
html_content = """
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="generator" content="WordPress 5.8.2">
    <title>示例网页</title>
</head>
<body>
    <div class="container">
        <h1>Hello World</h1>
    </div>
</body>
</html>
"""

# 提供HTTP头 (可选)
headers = [
    ("Server", "nginx/1.18.0"),
    ("X-Powered-By", "PHP/7.4.0")
]

# 执行指纹识别
results = observer_ward.execute(html_content, headers)

# 打印匹配结果
for result in results:
    print(f"名称: {result['name']}")
    print(f"模板: {result['template']}")
    print(f"标签: {', '.join(result['tags'])}")
    print(f"匹配关键词: {', '.join(result['matcher_names'])}")
    
    if result['extractor']:
        print("提取数据:")
        for key, values in result['extractor'].items():
            print(f"  {key}: {values}")
    
    print("-" * 40)

使用自定义指纹库

from observer_ward import ObserverWard
import json

# 读取自定义指纹库
with open("my_fingerprints.json", "r") as f:
    json_content = f.read()

# 使用自定义指纹库初始化ObserverWard
observer_ward = ObserverWard(json_content)

# 执行指纹识别
results = observer_ward.execute(html_content, headers)

# 打印结果
print(f"找到 {len(results)} 个匹配结果")
for result in results:
    print(f"名称: {result['name']}")
    # ...其他处理代码

构建开发版本

cd python
maturin develop

Project details


Download files

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

Source Distribution

observer_ward-0.1.0.tar.gz (86.9 kB view details)

Uploaded Source

Built Distribution

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

observer_ward-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

File details

Details for the file observer_ward-0.1.0.tar.gz.

File metadata

  • Download URL: observer_ward-0.1.0.tar.gz
  • Upload date:
  • Size: 86.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for observer_ward-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf0f917d40f6ecef2ad26524a75d010b60ee62358bea8696c6ce755b3da8cb61
MD5 2783f41812c85659a2e9659d0febf854
BLAKE2b-256 d7979adf02e0613214d4127e790ab22f8c66e52118dee0ad8094d20c9d7ce1b2

See more details on using hashes here.

File details

Details for the file observer_ward-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for observer_ward-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a231bc50d7d8579f34cf81beb85daa11d5db404e5d1438f838e2afdaba16761a
MD5 80dae76bc5cb34fbc365f5d1f8a27d40
BLAKE2b-256 0d125d5a9d605fa1bfbdd9bbdc6c5743d8eba5de16cdd58a4ad47d4ea694aef6

See more details on using hashes here.

Supported by

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