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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
dbslice — 本番データベースの一部を抽出して、ローカルでバグを再現します。dbslice をレコードに向けると、外部キーをたどって、完全でインポート可能なサブセットを提供します。 | Kitploit
ツール/GitHubGitHub/nabroleonx/dbslice
汎用ユーティリティ構成監査データ復旧DevSecOpsプライバシーデータベースセキュリティ
GitHubnabroleonx/dbslice

dbslice

本番データベースの一部を抽出して、ローカルでバグを再現します。dbslice をレコードに向けると、外部キーをたどって、完全でインポート可能なサブセットを提供します。

リポジトリを見る
141632ヶ月前Kitploit レビュー済み

人気

すべて見る →

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

すべてのツールを探索

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

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

dbslice ロゴ

dbslice

PyPI version License: MIT Python 3.10+

ローカル開発とデバッグのために、最小限で参照整合性を維持したデータベースサブセットを抽出します。

問題点

本番データベース全体を自分のマシンにコピーすることは現実的ではありません。しかし、バグを再現するには、その原因となった正確なデータが必要となることがよくあります。dbslice は、必要なレコードのみを抽出し、外部キー関係をたどって参照整合性を保証することで、この問題を解決します。

dbslice — シードからサブセットへ

クイックスタート

root@kitploit:~
# Install globally
uv tool install dbslice   # or: pip install dbslice

# Extract an order and all related records
dbslice extract postgres://localhost/myapp --seed "orders.id=12345" > subset.sql

# Import into local database
psql -d localdb < subset.sql

特徴

  • ゼロ設定で開始 -- スキーマを自動的に検査し、データモデルファイルは不要
  • 単一コマンド -- 1回のCLI呼び出しで完全なデータサブセットを抽出
  • デフォルトで安全 -- 機密フィールド(メール、電話番号、SSNなど)を自動検出して匿名化
  • コンプライアンスプロファイル -- GDPR、HIPAA Safe Harbor、PCI-DSSのプロファイルが内蔵されており、2段階のPIIスキャン機能付き
  • カラムマッピングUI -- ローカルブラウザUIでカラムを視覚的にマッピングし、コンプライアンスプロファイルを適用し、設定をエクスポート可能
  • 複数の出力形式 -- SQL、JSON、CSV
  • ストリーミング -- 大規模データセット(10万行以上)向けのメモリ効率の良い抽出
  • 仮想外部キー -- DjangoのGenericForeignKeyや、設定による暗黙的なリレーションシップをサポート
  • 設定ファイル -- YAMLベースの設定で反復可能な抽出を実現
  • 検証 -- 抽出データの参照整合性をチェック

データベース対応状況

データベースステータス
PostgreSQL完全対応
MySQL計画中(未実装)
SQLite計画中(未実装)

インストール

root@kitploit:~
# Install with uv (recommended)
uv add dbslice

# Try without installing
uvx dbslice --help

# Or with pip
pip install dbslice

使用方法

基本的な抽出

root@kitploit:~
# Extract by primary key
dbslice extract postgres://user:pass@host:5432/db --seed "orders.id=12345"

# Extract with WHERE clause
dbslice extract postgres://localhost/db --seed "orders:status='failed' AND created_at > '2024-01-01'"

# Multiple seeds
dbslice extract postgres://localhost/db \
  --seed "orders.id=100" \
  --seed "orders.id=101"

トラバーサルの制御

root@kitploit:~
# Limit depth (default: 3)
dbslice extract postgres://... --seed "orders.id=1" --depth 2

# Direction: up (parents only), down (children only), both (default)
dbslice extract postgres://... --seed "orders.id=1" --direction up

匿名化

root@kitploit:~
# Auto-anonymize detected sensitive fields
dbslice extract postgres://... --seed "users.id=1" --anonymize

# Redact additional fields
dbslice extract postgres://... --seed "users.id=1" --anonymize --redact "audit_logs.ip_address"

カラムマッピングUI

カラムを視覚的にマッピングし、コンプライアンスプロファイルを適用し、すぐに使える設定を生成 ― すべてローカルブラウザUIから行えます。

root@kitploit:~
dbslice map postgres://localhost/myapp

# Custom port
dbslice map postgres://localhost/myapp --port 8888

# Also works with uvx (no install needed)
uvx dbslice map postgres://localhost/myapp
カラムを匿名化ルールにマッピング設定を生成してエクスポート
カラムマッピング生成された設定

127.0.0.1:9473 で動作し、ワンタイムセッショントークンを使用 ― データがマシンから出ることはありません。ワンクリックでGDPR、HIPAA、PCI-DSSプロファイルを適用し、マスクされる内容を確認してからYAMLをダウンロードできます。

コンプライアンスプロファイル

root@kitploit:~
# HIPAA Safe Harbor — 18種類の識別子すべてを自動マスク
dbslice extract postgres://... --seed "patients.id=1" --compliance hipaa --compliance-strict

# Multiple profiles + audit manifest
dbslice extract postgres://... --seed "users.id=1" --compliance gdpr --compliance pci-dss -f subset.sql
# Produces subset.sql + subset.manifest.json

出力形式

root@kitploit:~
# SQL (default)
dbslice extract postgres://... --seed "orders.id=1" --output sql

# JSON fixtures
dbslice extract postgres://... --seed "orders.id=1" --output json --out-file fixtures/

# CSV
dbslice extract postgres://... --seed "orders.id=1" --output csv --out-file data/

仮想外部キー

データベーススキーマで定義されていないリレーションシップ(Django GenericForeignKey、暗黙的なリレーションシップ)の場合:

root@kitploit:~
# dbslice.yaml
database:
  url: postgres://localhost:5432/myapp

virtual_foreign_keys:
  - source_table: notifications
    source_columns: [object_id]
    target_table: orders
    description: "Generic FK to orders via ContentType"

  - source_table: audit_log
    source_columns: [user_id]
    target_table: users
    description: "Implicit FK without DB constraint"
root@kitploit:~
dbslice extract --config dbslice.yaml --seed "users.id=1"

スキーマの検査

root@kitploit:~
dbslice inspect postgres://localhost/myapp

設定ファイル

root@kitploit:~
# Generate config from database
dbslice init postgres://localhost/myapp --out-file dbslice.yaml

# Use config
dbslice extract --config dbslice.yaml --seed "orders.id=12345"

仕組み

  1. スキーマの検査 -- データベーススキーマを読み取り、テーブルと外部キーの関係を発見
  2. トラバース -- シードレコードから開始し、BFSで外部キー関係をたどる
  3. 抽出 -- 特定されたすべてのレコードを取得
  4. ソート -- テーブルをトポロジカルソートし、正しいINSERT順序を保証
  5. 出力 -- 適切なエスケープ処理を施したSQL/JSON/CSVを生成

比較

dbslice は軽量でゼロ設定のPythonオプションです。インストールして1分以内に抽出を開始できます。

開発

root@kitploit:~
git clone https://github.com/nabroleonx/dbslice.git
cd dbslice
uv sync --dev
uv run pytest

ライセンス

MIT

ツールをダウンロード
機能dbsliceJailerGreenmaskslice-db
言語PythonJavaGoRuby
設定ゼロ設定モデルファイルが必要設定が必要手動YAML
セットアップ時間数秒数時間中程度中程度
匿名化内蔵(Faker)プラグインベース高度なトランスフォーマー未対応
コンプライアンスプロファイルGDPR、HIPAA、PCI-DSSなしなしなし
カラムマッピングUI内蔵(ローカル)なしなしなし
PII値スキャン2段階(マスク前/後)なしなしなし
サブセット化FKトラバーサルFKトラバーサル制限ありFKトラバーサル
出力形式SQL、JSON、CSVSQL、XML、CSVSQLSQLのみ
サイクル処理自動手動設定N/A手動
ストリーミング内蔵設定可能内蔵未対応
メンテナンス活発活発活発メンテナンス停止