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

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

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

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

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
magika — 高速かつ正確なAI駆動のファイルコンテンツタイプ検出 | Kitploit
ツール/GitHubGitHub/google/magika
汎用ユーティリティ静的分析コード分析フォレンジックマルウェア分析機械学習
GitHubgoogle/magika

magika

高速かつ正確なAI駆動のファイルコンテンツタイプ検出

リポジトリを見る
17.9k1.1k21日前Kitploit レビュー済み

人気

すべて見る →

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

すべてのツールを探索

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

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

Magika

image NPM Version image image Go Version

OpenSSF Best Practices CodeQL Actions status PyPI Monthly Downloads PyPI Downloads

Magikaは、最新のディープラーニング技術を活用した新感覚のAI搭載ファイルタイプ検出ツールです。数MB程度の軽量で高度に最適化されたカスタムモデルを採用し、シングルCPUでも数ミリ秒で正確なファイル識別を実現します。Magikaは~100Mサンプル、200以上のコンテンツタイプ(バイナリ形式とテキスト形式の両方を含む)のデータセットで学習・評価されており、テストセットで平均~99%の精度を達成しています。

以下はMagikaのコマンドライン出力の例です:

Magikaは大規模に活用され、Gmail、Drive、Safe Browsingのファイルを適切なセキュリティ・コンテンツポリシースキャナーにルーティングすることでGoogleユーザーの安全性向上に貢献しており、毎週数千億のサンプルを処理しています。また、VirusTotal(例)やabuse.ch(例)にも統合されています。

詳細については、Google OSSブログの初回発表記事、Magikaのウェブサイト、およびIEEE/ACM International Conference on Software Engineering (ICSE) 2025で発表された研究論文をご参照ください。

何もインストールせずに、ブラウザ上でローカル動作するウェブデモでMagikaをお試しいただけます!

主な特長

  • Rust製のコマンドラインツール、Python API、および追加バインディング(Rust、JavaScript/TypeScript(実験的なnpmパッケージあり、ウェブデモを動作させています)、GoLang(作業中))として利用可能。
  • ~100Mファイル、200以上のコンテンツタイプのデータセットで学習・評価済み。
  • テストセットにおいて、Magikaは平均~99%の適合率と再現率を達成し、既存の手法(特にテキストコンテンツタイプ)を上回ります。
  • モデル読み込み(1回限りのオーバーヘッド)後、シングルCPUでも推論時間はファイルあたり約5ms。
  • 同時に数千ファイルを指定してMagikaを呼び出せます。ディレクトリを再帰的にスキャンするには-rも使用可能。
  • ファイルサイズに依存せずほぼ一定の推論時間。ファイル内容のごく一部のみを使用。
  • コンテンツタイプごとのしきい値システムにより、モデルの予測を「信頼」するか、「Generic text document」「Unknown binary data」などの汎用ラベルを返すかを決定します。
  • high-confidence、medium-confidence、best-guessなどの異なる予測モードでエラー耐性を制御可能。
  • クライアントとバインディングはすでにオープンソース化されており、さらに多くの機能がまもなく提供予定です。

目次

  1. はじめに
    1. インストール
    2. クイックスタート
  2. ドキュメント
  3. セキュリティ脆弱性
  4. ライセンス
  5. 免責事項

はじめに

インストール

コマンドラインツール

MagikaはRustで書かれたCLIを提供し、複数の方法でインストールできます。

magika Pythonパッケージ経由:

root@kitploit:~
pipx install magika

brew経由(macOS / Linux)

root@kitploit:~
brew install magika

インストーラースクリプト経由:

root@kitploit:~
curl -LsSf https://securityresearch.google/magika/install.sh | sh

または:

root@kitploit:~
powershell -ExecutionPolicy Bypass -c "irm https://securityresearch.google/magika/install.ps1 | iex"

magika-cli Rustパッケージ経由:

root@kitploit:~
cargo install --locked magika-cli

Pythonパッケージ

root@kitploit:~
pip install magika

JavaScriptパッケージ

root@kitploit:~
npm install magika

クイックスタート

以下に、すぐに使い始めるための簡単な例をいくつか示します。

Magikaの内部動作については、Magikaウェブサイトのコアコンセプトセクションをご覧ください。

コマンドラインツールの例

root@kitploit:~
% cd tests_data/basic && magika -r * | head
asm/code.asm: Assembly (code)
batch/simple.bat: DOS batch file (code)
c/code.c: C source (code)
css/code.css: CSS source (code)
csv/magika_test.csv: CSV document (code)
dockerfile/Dockerfile: Dockerfile (code)
docx/doc.docx: Microsoft Word 2007+ document (document)
docx/magika_test.docx: Microsoft Word 2007+ document (document)
eml/sample.eml: RFC 822 mail (text)
empty/empty_file: Empty file (inode)
root@kitploit:~
% magika ./tests_data/basic/python/code.py --json
[
  {
    "path": "./tests_data/basic/python/code.py",
    "result": {
      "status": "ok",
      "value": {
        "dl": {
          "description": "Python source",
          "extensions": [
            "py",
            "pyi"
          ],
          "group": "code",
          "is_text": true,
          "label": "python",
          "mime_type": "text/x-python"
        },
        "output": {
          "description": "Python source",
          "extensions": [
            "py",
            "pyi"
          ],
          "group": "code",
          "is_text": true,
          "label": "python",
          "mime_type": "text/x-python"
        },
        "score": 0.996999979019165
      }
    }
  }
]
root@kitploit:~
% cat tests_data/basic/ini/doc.ini | magika -
-: INI configuration file (text)
root@kitploit:~
% magika --help
Determines file content types using AI

Usage: magika [OPTIONS] [PATH]...

Arguments:
  [PATH]...
          List of paths to the files to analyze.

          Use a dash (-) to read from standard input (can only be used once).

Options:
  -r, --recursive
          Identifies files within directories instead of identifying the directory itself

      --no-dereference
          Identifies symbolic links as is instead of identifying their content by following them

      --colors
          Prints with colors regardless of terminal support

      --no-colors
          Prints without colors regardless of terminal support

  -s, --output-score
          Prints the prediction score in addition to the content type

  -i, --mime-type
          Prints the MIME type instead of the content type description

  -l, --label
          Prints a simple label instead of the content type description

      --json
          Prints in JSON format

      --jsonl
          Prints in JSONL format

      --format <CUSTOM>
          Prints using a custom format (use --help for details).

          The following placeholders are supported:

            %p  The file path
            %l  The unique label identifying the content type
            %d  The description of the content type
            %g  The group of the content type
            %m  The MIME type of the content type
            %e  Possible file extensions for the content type
            %s  The score of the content type for the file
            %S  The score of the content type for the file in percent
            %b  The model output if overruled (empty otherwise)
            %%  A literal %

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

CLIの詳細な例とドキュメントについては、https://crates.io/crates/magika-cli をご覧ください。

Pythonの例

root@kitploit:~
>>> from magika import Magika
>>> m = Magika()
>>> res = m.identify_bytes(b'function log(msg) {console.log(msg);}')
>>> print(res.output.label)
javascript
root@kitploit:~
>>> from magika import Magika
>>> m = Magika()
>>> res = m.identify_path('./tests_data/basic/ini/doc.ini')
>>> print(res.output.label)
ini
root@kitploit:~
>>> from magika import Magika
>>> m = Magika()
>>> with open('./tests_data/basic/ini/doc.ini', 'rb') as f:
>>>     res = m.identify_stream(f)
>>> print(res.output.label)
ini

Pythonモジュールの詳細な例とドキュメントについては、Python Magika モジュールセクションをご覧ください。

ドキュメント

詳しいドキュメントについては、Magikaのウェブサイトをご確認ください:

  • コアコンセプト
    • Magikaの仕組み
    • モデルとコンテンツタイプ
    • 予測モード
    • 出力の解釈
  • CLIとバインディング(Pythonモジュール、JavaScriptモジュールなど)
  • コントリビューション
  • FAQ
  • その他

セキュリティ脆弱性

直接、[email protected] までご連絡ください。

ライセンス

Apache 2.0; 詳細はLICENSEをご覧ください。

免責事項

本プロジェクトはGoogleの公式プロジェクトではありません。Googleによるサポートはなく、Googleはその品質、商品性、特定目的への適合性に関するすべての保証を明示的に否認します。

ツールをダウンロード