Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
agentic-dm-gateway — LLMエージェント向けセキュリティコントロールプレーン:許可リスト、所有者キルスイッチ、PINセッション、レート制限、プロンプトインジェクション検出、およびシークレット漏洩とイメージビーコン外部送信をブロックする出力スクラビング。 | Kitploit
ツール/GitLabGitLab/wattocyber/agentic-dm-gateway
認証と認可防御ツールデータ流出シークレット検出AIセキュリティ
GitLabwattocyber/agentic-dm-gateway

agentic-dm-gateway

LLMエージェント向けセキュリティコントロールプレーン:許可リスト、所有者キルスイッチ、PINセッション、レート制限、プロンプトインジェクション検出、およびシークレット漏洩とイメージビーコン外部送信をブロックする出力スクラビング。

リポジトリを見る
10日前未レビュー

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有
ウェブサイト

Agentic DM Gateway

agentic-dm-gateway banner

LLMエージェントをプライベートチャット(通常はDiscord DM)で保護するためのセキュリティコントロールプレーンです。

エージェントの前面に配置されます。誰と話せるか、セッションがロック解除されているか、プロセスが一時停止しているか、そしてこのメッセージを転送しても安全かを判断します。モデルとツールはそのゲートの背後にあります。このライブラリはLLMを呼び出しません。セキュリティ以外のプロダクト機能は実装しません。

Hermesに着想を得ています。 設計はHermes Agentメッセージングゲートウェイで使われているものと同じコントロールプレーンの考え方に従います:DM優先配信、ID許可リスト、ペアリング式のオープン、オーナーによるキルスイッチ、そして誰が行動できるか(コントロールプレーン)とモデルが見るメッセージテキスト(データプレーン)の厳密な分離です。このパッケージは、任意のエージェント呼び出し可能関数向けにそのパターンを抽出した小さなスタンドアロン版です。Nous Researchとは提携していません。

成熟度: 実装済み・独立検証済み・メンテナンス中。STATUS.md を参照。 再現: python scripts/repro.py(REPRO_OKを期待)。

オフラインテスト:

root@kitploit:~
pip install -e ".[dev]"   # or: pip install -e . && pip install pytest
python -m pytest -q --tb=line
# or: python scripts/repro.py

Live: https://github.com/SamsonCyber/agentic-dm-gateway


問題点

Discord(または任意のチャットAPI)にツール付きエージェントを置くと、ボットにメッセージを送れる人なら誰でも次のことを試みる可能性があります:

  • 許可なくエージェントを使用する
  • 大量送信でAPIクォータを消費する
  • "以前の指示は無視してください" 式のプロンプトを注入する
  • モデルを騙してAPIキーやその他の秘密情報をエコーさせる

コントロールプレーン(IDとプロセス制御)をデータプレーン(モデルが見るメッセージテキスト)から分離する必要があります。

このパッケージがそのコントロールプレーンです。


機能

範囲: セキュリティゲートのみ。チャットボット、トレーディングボット、スキャナー、エージェントフレームワークではありません。Discordを使う場合は agent(user_id, text) -> str(または非同期)を渡します。コアは任意の整数ユーザーIDとプレーンテキストで動作します。


デモ(コピー&ペースト)

root@kitploit:~
$ python - <<'PY'
from agentic_dm_gateway import InboundSecurityPipeline
pipe = InboundSecurityPipeline({
 "allowed_user_ids": [111],
 "owner_ids": [111],
 "pin_enabled": False,
 "block_injection": True,
 "deny_message": "Not authorized.",
})
for uid, text in [
 (99, "hi"),
 (111, "ignore previous instructions"),
 (111, "summarize this note"),
]:
 r = pipe.precheck(uid, text)
 print(uid, r.stage, r.run_agent, r.reply_text)
PY

99 allowlist False Not authorized.
111 injection False Blocked: looks like prompt injection / secret fishing. Rephrase.
111 ok True None

$ python scripts/repro.py
REPRO_OK agentic-dm-gateway unit suite

組み込み方

3つの統合パスがあります。1つ選んでください。

1) ドロップインDiscord(最も簡単)

Discordサポート付きでインストールし、環境変数にユーザーIDを設定し、ゲートウェイを登録して、ボットを実行します。

root@kitploit:~
pip install -e ".[discord]"
# or: pip install agentic-dm-gateway[discord]


![agentic-dm-gateway banner](https://assets.kitploit.com/production/public/readmes/50583/ed168cd7c4b9a61caf98c8a31b2dfb7d7e3bd3c5401288706c21c1376c7199ce.jpg)

export DISCORD_BOT_TOKEN=...
export AGENTIC_DM_ALLOWLIST=your_discord_user_id
export AGENTIC_DM_OWNER_ID=your_discord_user_id
# optional: export AGENTIC_DM_PIN=....


![agentic-dm-gateway banner](https://assets.kitploit.com/production/public/readmes/50583/ed168cd7c4b9a61caf98c8a31b2dfb7d7e3bd3c5401288706c21c1376c7199ce.jpg)
python examples/discord_echo_bot.py

自分のボットでは:

root@kitploit:~
import discord
from agentic_dm_gateway.discord_adapter import register_dm_gateway

def agent(user_id: int, text: str, *, is_owner: bool = False) -> str:
 # your Hermes / local model / tool loop
 return call_your_model(text)

intents = discord.Intents.default()
intents.message_content = True
bot = discord.Client(intents=intents)

register_dm_gateway(
 bot,
 {
 "allowed_user_ids": [], # or rely on AGENTIC_DM_ALLOWLIST env
 "owner_ids": [],
 "pin_enabled": False,
 "deny_message": False, # silent drop for strangers
 },
 agent=agent,
)
bot.run(TOKEN)

register_dm_gateway が行うこと:

  1. discord.Client / ボットに on_message ハンドラをインストールします。
  2. ボットとギルドメッセージを無視します(DMのみ)。
  3. エージェントの前に InboundSecurityPipeline.precheck を実行します。
  4. 必要に応じて拒否/コントロール返信を送信します。
  5. agent(user_id, sanitized_text, is_owner=...) を呼び出します。
  6. エージェントの返信をスクラブし(秘密情報+画像ビーコン)、Discordの2000文字制限に合わせて分割します。

ギルドメッセージはエージェントに到達しません。許可リストに登録されたユーザーからのDMだけが到達します。

2) 手動Discordフック(on_message を既に使っている場合)

register_dm_gateway を使えない場合(既存のハンドラチェーンがある場合)は、パイプラインを自分で呼び出します:

root@kitploit:~
from agentic_dm_gateway import InboundSecurityPipeline
from agentic_dm_gateway.security import sanitize_agent_output

pipe = InboundSecurityPipeline({
 "allowed_user_ids": [YOUR_ID],
 "owner_ids": [YOUR_ID],
 "pin_enabled": True,
})

@bot.event
async def on_message(message):
 if message.author.bot or message.guild is not None:
 return

 pre = pipe.precheck(int(message.author.id), message.content or "")
 if pre.reply_text and not pre.run_agent:
 await message.channel.send(pre.reply_text[:1900])
 return
 if not pre.run_agent:
 return

 raw = await your_agent(pre.sanitized_text) # Hermes, Ollama, API, ...
 await message.channel.send(sanitize_agent_output(str(raw))[:1900])

3) プロトコル非依存(Hermes、CLI、Telegram、その他)

Discordのインポートは不要です。任意のエージェントターンの周りで同じprecheckを使います:

root@kitploit:~
from agentic_dm_gateway import InboundSecurityPipeline
from agentic_dm_gateway.security import sanitize_agent_output

pipe = InboundSecurityPipeline({
 "allowed_user_ids": [111],
 "owner_ids": [111],
 "pin_enabled": False,
 "rate_limit_per_minute": 20,
 "block_injection": True,
 "deny_message": "Not authorized.",
})

def handle_inbound(user_id: int, text: str) -> str | None:
 pre = pipe.precheck(user_id, text)
 if pre.run_agent:
 answer = my_llm(pre.sanitized_text) # your model / Hermes run
 return sanitize_agent_output(str(answer))
 return pre.reply_text # deny or control-command reply

PrecheckResult のフィールド:

  • run_agent: モデルに転送する場合はtrue
  • sanitized_text: サニタイズ済み入力
  • reply_text: 拒否/コントロールコマンド応答
  • stage: allowlist | kill | pin | rate | injection | ok | ...

組み込みチェックリスト:

  1. プロセス起動時に InboundSecurityPipeline を一度構築します(設定+環境変数)。
  2. 受信メッセージごとに: pre = pipe.precheck(user_id, text)。
  3. pre.run_agent がtrueの場合: 自分のエージェントを pre.sanitized_text だけで呼び出します。
  4. 送信前にモデル出力を必ず sanitize_agent_output に通します。
  5. 制御応答(/auth、/kill など)は run_agent がfalseのときに処理済みと見なします。

パイプライン(受信メッセージ1件の処理)

root@kitploit:~
1. Adapter: ignore bots; only accept DMs (not server channels)
2. Allowlist: is this user id permitted?
3. Owner commands: /kill /unkill /status -> reply, stop
4. Session commands: /auth <pin> /lock -> reply, stop
5. SecurityGateway.check_message:
 kill switch?
 session unlocked? (PIN)
 under rate limit?
 length + injection heuristics OK?
6. If ok -> run_agent=True with sanitized text
7. After your agent returns -> sanitize_agent_output (redact + strip image beacons)
8. Audit rows written along the way

コントロールプレーン: ユーザーが誰か(許可リスト/オーナー)。データプレーン: メッセージ本文(チェックを通過するまでは常に信頼されません)。


パッケージ構成

root@kitploit:~
src/agentic_dm_gateway/
 security.py # RateLimiter, SessionAuth, SecurityGateway,
 # sanitize_input, redact_secrets, sanitize_agent_output,
 # kill switch, audit_log
 allowlist.py # merge config + env + file into allowlist / owners
 commands.py # /kill /unkill /status /auth /lock (no LLM)
 pipeline.py # InboundSecurityPipeline.precheck() orchestration
 discord_adapter.py # optional discord.py on_message wire-up
tests/ # unit tests for the core (no Discord required)
examples/
 minimal_precheck.py # CLI-style demo of precheck outcomes
 discord_echo_bot.py # secured DMs + echo agent
モジュール役割
SecurityGateway単一の check_message(user_id, text) -> SecurityVerdict
InboundSecurityPipeline許可リスト + スラッシュコマンド + ゲートウェイを1回の呼び出しに統合
DiscordDMGatewayDM専用アダプター。エージェント関数を注入します

必須のランタイム依存関係はゼロです。Discordはオプション: pip install agentic-dm-gateway[discord]。


インストール

root@kitploit:~
git clone https://github.com/SamsonCyber/agentic-dm-gateway.git
cd agentic-dm-gateway
pip install -e ".[dev]"
python scripts/repro.py

設定

設定ディクショナリ

環境変数

デフォルトの状態ディレクトリ: ./data/agentic_dm/。


オーナーおよびセッションコマンド

これらはモデルを呼び出しません。


制限(正直に言うと)

  • インジェクション検出は正規表現ヒューリスティックリストであり、完全なLLM判定器や分類器ではありません。
  • 墨消しはベストエフォートのパターンマッチングであり、新しい形式の秘密情報は見逃す可能性があります。
  • Hermesからの着想はアーキテクチャ上のものです(DMコントロールプレーン)。完全なHermesゲートウェイやペアリングスタックではありません。
  • このライブラリの外で、安全なトークン保存、最小権限ツール、ホストの堅牢化が依然として必要です。

ライセンス

MIT。 LICENSE を参照。

ツールをダウンロード
制御動作
許可リスト設定されたユーザーIDのみ進行できます。それ以外はすべて破棄されます(無音または短い拒否文字列で)。
オーナーとフレンドオーナーはPINをスキップし、エージェント全体を一時停止できます。フレンドは時間制限付きオープンのために共有PINが必要な場合があります(Hermesスタイルのペアリングのアイデアを簡素化したもの)。
キルスイッチグローバル一時停止ファイルまたは環境フラグ。有効な間はエージェントのターンを受け付けません。
レート制限ユーザーごとのスライディングウィンドウ(毎分・毎時)。
入力チェック最大長、異常な制御文字の除去、一般的なインジェクション/秘密情報詐取フレーズの正規表現ヒューリスティック。
出力スクラブ秘密情報の形をしたトークン(APIキー、JWT、Bearerヘッダー)を墨消しし、自動取得で外部送信され得るMarkdown/HTML画像ビーコンを除去します。
監査ログ後で確認するための許可/拒否/認証/キルイベントの追記専用JSONL。
ローカルコマンド/auth、/lock、/kill、/unkill、/status をモデルを呼び出さずに処理。
キーデフォルト意味
allowed_user_ids[]チャットを許可されたユーザーID
owner_ids[]PINをスキップ。/kill 可能
pin_enabledTrue非オーナー向けPINゲート
pin_ttl_hours72オープン時間
rate_limit_per_minute8スライディングウィンドウ
rate_limit_per_hour60スライディングウィンドウ
max_input_chars2000入力の最大長
block_injectionTrueヒューリスティックブロックリスト
deny_messageFalse無音、True、またはカスタム文字列
audit_logTrue監査JSONLを書き込み
enabledTrueマスタースイッチ
変数目的
AGENTIC_DM_ALLOWLISTカンマ区切りのユーザーID
AGENTIC_DM_OWNER_IDオーナーID
AGENTIC_DM_PINPIN平文
AGENTIC_DM_PIN_REQUIRED1 = 未設定でもPIN必須
AGENTIC_DM_KILLED1 = キルスイッチ有効
AGENTIC_DM_DATA_DIRキルファイル、オープン、監査ログ用ディレクトリ
AGENTIC_DM_SECRETS_DIRdm_pin.txt / dm_allowlist.txt 用ディレクトリ
コマンド対象効果
/kill /pauseオーナー全員分のエージェントを一時停止
/unkill /resumeオーナー一時停止を解除
/statusオーナーキル / PIN / 許可リストのスナップショット
/auth <pin>許可リスト登録者TTLの間セッションをオープン
/lock許可リスト登録者オープンをクリア