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,
    api_id=API_ID,
    api_hash=API_HASH,
    session=SESSION,
    group_id=GROUP_ID,
    chat_token=CHAT_TOKEN,
    kdefender_id=K_DEFENDER_ID,
)

@kdefender_check()
async def handler(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 Distribution

kdefender_wrapper-0.2.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

kdefender_wrapper-0.2.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file kdefender_wrapper-0.2.0.tar.gz.

File metadata

  • Download URL: kdefender_wrapper-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for kdefender_wrapper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4efc021b5fda15e0db3312c91055227b97fe2eb1bd7e322d44274fb089be427a
MD5 2b52e8a8d1e1fef85933585a3d9ebb5a
BLAKE2b-256 f7c29c6eb8e65804b8de90594b555d8f901e790c38ad79c7d7040f2f84970c51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kdefender_wrapper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1682bc39bdfdeab367b9ee4850ab7544cfc54394bc9a0f8a3990fdf344a12318
MD5 8ebd9082e4e51bff2c8609a0fdc34957
BLAKE2b-256 0e3e163f357190b887da11d3ec3cb9cd7578c0b981388f866446fb62fad36794

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