Skip to main content

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

  1. User message is intercepted
  2. Text is sent to K-Defender group
  3. JSON verdict is awaited
  4. Message is allowed or blocked based on verdict
  5. 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

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

kdefender_wrapper-0.3.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file kdefender_wrapper-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kdefender_wrapper-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c932e6cf6ee544081625bbe93b5db362777fc3f6675dc129d58bffca9e6b3b06
MD5 9de2bdca21cebe30adfef52c3be1af90
BLAKE2b-256 70e3c47348587f93ee63f5a1d6cfd402da618c6107cf9ea81c26a4bb665f849e

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