Snapshot của google/magika: 17.9k★ · Python · AI Tools. Fast and accurate AI powered file content types detection
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Magika is a novel AI-powered file type detection tool that relies on the recent advance of deep learning to provide accurate detection. Under the hood, Magika employs a custom, highly optimized model that only weighs about a few MBs, and enables precise file identification within milliseconds, even when running on a single CPU. Magika has been trained and evaluated on a dataset of ~100M samples across 200+ content types (covering both binary and textual file formats), and it achieves an average ~99% accuracy on our test set.
Here is an example of what Magika command line output looks like:
Magika is used at scale to help improve Google users' safety by routing Gmail, Drive, and Safe Browsing files to the proper security and content policy scanners, processing hundreds billions samples on a weekly basis. Magika has also been integrated with VirusTotal (example) and abuse.ch (example).
For more context you can read our initial announcement post on Google's OSS blog, you can consult Magika's website, and you can read more in our research paper, published at the IEEE/ACM International Conference on Software Engineering (ICSE) 2025.
You can try Magika without installing anything by using our web demo, which runs locally in your browser!
Highlights
Available as a command line tool written in Rust, a Python API, and additional bindings for Rust, JavaScript/TypeScript (with an experimental npm package, which powers our web demo), and GoLang (WIP).
Trained and evaluated on a dataset of ~100M files across 200+ content types.
On our test set, Magika achieves ~99% average precision and recall, outperforming existing approaches -- especially on textual content types.
After the model is loaded (which is a one-off overhead), the inference time is about 5ms per file, even when run on a single CPU.
You can invoke Magika with even thousands of files at the same time. You can also use -r for recursively scanning a directory.
Near-constant inference time, independently from the file size; Magika only uses a limited subset of the file's content.
Magika uses a per-content-type threshold system that determines whether to "trust" the prediction for the model, or whether to return a generic label, such as "Generic text document" or "Unknown binary data".
The tolerance to errors can be controlled via different prediction modes, such as high-confidence, medium-confidence, and best-guess.
The client and the bindings are already open source, and more is coming soon!
Table of Contents
Getting Started
Installation
Quick Start
Documentation
Security Vulnerabilities
License
Disclaimer
Getting Started
Installation
Command Line Tool
Magika ships a CLI written in Rust, and can be installed in several ways.
Via magika python package:
pipx install magika
Via brew (macOS / Linux)
brew install magika
Via installer script:
curl -LsSf https://securityresearch.google/magika/install.sh | sh
% 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
For more examples and documentation about the CLI, see https://crates.io/crates/magika-cli.
Python Examples
>>> from magika import Magika
>>> m = Magika()
>>> res = m.identify_bytes(b'function log(msg) {console.log(msg);}')
>>> print(res.output.label)
javascript
>>> from magika import Magika
>>> m = Magika()
>>> res = m.identify_path('./tests_data/basic/ini/doc.ini')
>>> print(res.output.label)
ini
>>> 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
For more examples and documentation about the Python module, see the Python Magika module section.
Documentation
Please consult Magika's website for detailed documentation about:
This project is not an official Google project. It is not supported by
Google and Google specifically disclaims all warranties as to its quality,
merchantability, or fitness for a particular purpose.
google/magika thuộc nhóm AI Tools trên TopGit, cùng 7 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về google/magika ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/google/magika là nguồn chính thức.
google/magika có bao nhiêu sao?
google/magika có 17.9k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/google/magika. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
google/magika có phải mã nguồn mở không?
Có — google/magika phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/google/magika.
google/magika có trang demo không?
Dự án có trang chủ ở https://securityresearch.google/magika/. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
google/magika là gì?
google/magika (google/magika) là dự án Python trên GitHub. Theo mô tả gốc: Fast and accurate AI powered file content types detection
google/magika so với các dự án AI Tools khác thế nào?
google/magika được TopGit xếp vào nhóm AI Tools, với 17.9k sao GitHub và viết bằng Python. Xem trang chủ đề AI Tools trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về magika?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về magika.