
빠르고 정확한 AI 기반 파일 콘텐츠 유형 탐지
Magika는 최신 딥러닝 기술을 활용하여 정확한 파일 유형 탐지를 제공하는 혁신적인 AI 기반 파일 유형 탐지 도구입니다. 내부적으로 Magika는 수 MB에 불과한 맞춤형, 고도로 최적화된 모델을 사용하며, 단일 CPU에서도 수 밀리초 내에 정밀한 파일 식별이 가능합니다. Magika는 200개 이상의 콘텐츠 유형(바이너리 및 텍스트 파일 형식 모두 포함)에 걸쳐 약 1억 개의 샘플로 구성된 데이터셋으로 학습 및 평가되었으며, 테스트 세트에서 평균 약 99%의 정확도를 달성합니다.
다음은 Magika 명령줄 출력의 예시입니다:
Magika는 대규모로 사용되어 Gmail, Drive 및 Safe Browsing 파일을 적절한 보안 및 콘텐츠 정책 스캐너로 라우팅하여 Google 사용자의 안전을 향상시키는 데 도움을 주며, 주당 수천억 개의 샘플을 처리합니다. Magika는 VirusTotal (예제) 및 abuse.ch (예제)와도 통합되었습니다.
자세한 내용은 Google OSS 블로그의 초기 발표 게시물을 읽거나, Magika 웹사이트를 방문하거나, IEEE/ACM 국제 소프트웨어 공학 컨퍼런스(ICSE) 2025에 게재된 연구 논문에서 더 많은 정보를 확인할 수 있습니다.
아무것도 설치하지 않고 웹 데모를 통해 Magika를 사용해 볼 수 있습니다. 이 데모는 브라우저에서 로컬로 실행됩니다!
-r 옵션을 사용하여 디렉토리를 재귀적으로 스캔할 수도 있습니다.high-confidence, medium-confidence, best-guess와 같은 다양한 예측 모드를 통해 오류 허용 범위를 제어할 수 있습니다.Magika는 Rust로 작성된 CLI를 제공하며, 여러 가지 방법으로 설치할 수 있습니다.
magika python 패키지를 통해:
pipx install magika
brew를 통해 (macOS / Linux)
brew install magika
설치 스크립트를 통해:
curl -LsSf https://securityresearch.google/magika/install.sh | sh
또는:
powershell -ExecutionPolicy Bypass -c "irm https://securityresearch.google/magika/install.ps1 | iex"
magika-cli Rust 패키지를 통해:
cargo install --locked magika-cli
pip install magika
npm install magika
다음은 빠르게 시작할 수 있도록 몇 가지 예제를 제공합니다.
Magika의 내부 작동 방식에 대한 자세한 내용은 Magika 웹사이트의 핵심 개념 섹션을 참조하십시오.
% 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)
% 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
}
}
}
]
% cat tests_data/basic/ini/doc.ini | magika -
-: INI configuration file (text)
% 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 를 참조하십시오.
>>> 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
Python 모듈에 대한 더 많은 예제와 문서는 Python Magika 모듈 섹션을 참조하십시오.
Magika 웹사이트에서 다음에 대한 자세한 문서를 확인하십시오:
직접 [email protected] 으로 연락해 주시기 바랍니다.
Apache 2.0; 자세한 내용은 LICENSE를 참조하십시오.
이 프로젝트는 공식 Google 프로젝트가 아닙니다. Google에서 지원하지 않으며, Google은 특히 품질, 상업성 또는 특정 목적에의 적합성에 대한 모든 보증을 명시적으로 부인합니다.