A Telegram bot wrapper for K-Defender security
Project description
K-Defender-wrapper
🛡️ K-Defender-wrapper is an async Python wrapper that integrates Telegram bots with K-Defender, providing centralized message filtering and injection protection.
Designed for aiogram / Telethon-based bots.
Features
- Async-safe verdict requests
- Telethon-based backend listener
- Decorator-based protection (
@kdefender_check) - Injection detection (via K-Defender)
- Safe-by-default blocking
- Zero business logic coupling
Installation
pip install kdefender-wrapper
Quick Start
import asyncio
from kdefender_wrapper import setup, kdefender_check
await setup(
bot=bot,
url=URL,
chat_token=CHAT_TOKEN,
lang="en" # language
)
@kdefender_check()
async def handler_auto_parameter_detection(message):
await message.answer("✅ Message accepted")
# OR
@kdefender_check(param="message")
async def handler_with_parameter(message):
await message.answer("✅ Message accepted")
How It Works
- User message is intercepted
- Text is sent to K-Defender group
- JSON verdict is awaited
- Message is allowed or blocked based on verdict
- All checks are serialized and timeout-safe.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kdefender_wrapper-0.3.2-py3-none-any.whl.
File metadata
- Download URL: kdefender_wrapper-0.3.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c932e6cf6ee544081625bbe93b5db362777fc3f6675dc129d58bffca9e6b3b06
|
|
| MD5 |
9de2bdca21cebe30adfef52c3be1af90
|
|
| BLAKE2b-256 |
70e3c47348587f93ee63f5a1d6cfd402da618c6107cf9ea81c26a4bb665f849e
|