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.1.0.tar.gz (4.8 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.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kdefender_wrapper-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 73e01d83f19b9a35102c387114592aa7c01e1303f049426a4ed16fe06af6b52b
MD5 58a185bfe6ad950db10f8703f90e1084
BLAKE2b-256 f2162dde95592a3113b372f1b71aad1cbd7dff82e3cd22f7974c1309f5a01aa7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kdefender_wrapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c3afae294fc47def6d009b3a50c25fce4bf3bed937cc11eee4cc38611b773d2
MD5 9aea3f4df4a2c8a5919acd60b68ebd8b
BLAKE2b-256 2a2c4d5a6ff7ce3c35ff8577ea8b5874ea8177ad5453cb576c011e9342aac18c

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