
Python implementation of the CaRT library for (un)inerting files.
CaRT 文件格式用于存储/传输恶意软件及其相关元数据。它会使恶意软件失效,使其无法执行,并对其进行加密,从而避免杀毒软件将 CaRT 文件标记为恶意软件。
既然 STIX v2 使用 JSON 作为编码格式,您现在可以直接将 STIX 报告捆绑到 CaRT 格式中。当 CaRT 编码文件时,它会从与您的文件具有相同前缀的 *.cartmeta 文件中添加元数据。因此,如果您将 STIX 报告保存到 .cartmeta 文件中,生成的 CaRT 文件将内嵌完整的 STIX 报告。
示例:
$ ls
file.exe - File I want to encode
file.exe.cartmeta - Stix report of file.exe
$ cart file.exe
$ ls
file.exe - File I want to encode
file.exe.cartmeta - Stix report of file.exe
file.exe.cart - CaRT file containing both the file.exe and its STIX report
CaRT 具有一个必需的头部,格式如下:
4s h Q 16s Q
CART<VERSION><RESERVED><ARC4KEY><OPT_HEADER_LEN>
其中 VERSION 为 1,RESERVED 为 0。在大多数情况下,用于解密文件的 RC4 密钥存储在必需头部中,并且始终相同(π 的前 8 位数字重复两次)。然而,CaRT 提供了一种覆盖密钥的选项,使用该选项时,必需头部中将存储空字节。届时,您需要知道该密钥才能解包 CaRT 文件……
CaRT 的可选头部是一个长度为 OPT_HEADER_LEN 字节的 RC4 数据块,内容为经过 JSON 序列化的头部。
RC4(<JSON_SERIALIZED_OPTIONAL_HEADER>)
CaRT 的数据块是一个先经 zlib 压缩、再进行 RC4 加密的数据块。
RC4(ZLIB(block encoded stream))
与可选头部类似,CaRT 的可选页脚是一个长度为 OPT_FOOTER_LEN 字节的 RC4 数据块,内容为经过 JSON 序列化的页脚。
RC4(<JSON_SERIALIZED_OPTIONAL_FOOTER>)
CaRT 文件以必需页脚结尾,该页脚使格式能够在不读取整个文件的情况下读取页脚并返回哈希值。
4s QQ Q
TRAC<RESERVED><OPT_FOOTER_LEN>
通过安装 pip 包,您可以使用 CaRT 库,同时也可以使用 CaRT CLI。
CaRT CLI 的选项优先级如下:
~/.cart/cart.cfg 中的选项会覆盖默认值以下是 CaRT CLI 中可用的选项:
usage: cart [options] file1 file2 ... fileN
The CaRT file format is used to store/transfer malware and its associated metadata.
It neuters the malware so it cannot be executed and encrypts it so anti-virus software
cannot flag the CaRT file as malware.
positional arguments:
file
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-d, --delete Delete original after operation succeeded
-f, --force Replace output file if it already exists
-i, --ignore Ignore RC4 key from conf file
-j JSONMETA, --jsonmeta JSONMETA
Provide header metadata as JSON blob
-k KEY, --key KEY Use private RC4 key (base64 encoded). Same key must be provided to unCaRT.
-m, --meta Keep metadata around when extracting CaRTs
-n FILENAME, --name FILENAME
Use this value as metadata filename
-o OUTFILE, --outfile OUTFILE
Set output file
-s, --showmeta Only show the file metadata
CaRT is smart enough to determine if a file needs to be CaRTed or unCaRTed.
To CaRT an unCaRTed file: cart file1
To unCaRT a CaRTed file: cart file1
It is the same command!
CaRT 配置文件如下所示:
[global]
# rc4_key is a base64 representation of your key
rc4_key: AvUzYXNkZg==
# keep_meta is an equivalent to -m in the CLI
keep_meta: True
# force is an equivalent to -f in the CLI
force: True
# default_header is a key/value pair of data to be added to the CaRT in the optional header
[default_header]
poc: Your Name
poc_email: [email protected]
CaRT 还有 Rust 和 Java 语言的实现,请查看以下链接:
CaRT 文件格式用于存储和传输恶意软件及其相关元数据。它会使恶意软件失效,使其无法执行,并对其进行加密,以便杀毒软件不会将 CaRT 文件标记为恶意软件。
既然 STIX v2 现在使用 JSON 进行编码,您可以将 STIX 报告直接捆绑到 CaRT 格式中。当 CaRT 对文件进行编码时,它会从与您的文件具有相同前缀的 *.cartmeta 文件中添加元数据。因此,如果您将 STIX 报告保存到 .cartmeta 文件中,完整的报告将内嵌在生成的 CaRT 文件中。
例如:
$ ls
file.exe - Fichier à coder
file.exe.cartmeta - Rapport STIX du fichier file.exe
$ cart file.exe
$ ls
file.exe - Fichier à coder
file.exe.cartmeta - Rapport STIX du fichier file.exe
file.exe.cart - Fichier CaRT contenant à la fois le fichier file.exe et son rapport STIX
CaRT 具有一个必需的头部,格式如下:
4s h Q 16s Q
CART<VERSION><RESERVED><ARC4KEY><OPT_HEADER_LEN>
在该头部中,VERSION 的值为 1,RESERVED 的值为 0。在大多数情况下,用于解密文件的 RC4 密钥存储在其中,并且始终相同(π 的前 8 位数字重复两次)。不过,CaRT 提供了一种替换密钥的方法,即在必需头部中存储空字节。届时,您需要知道该密钥才能解码 CaRT 文件。
CaRT 的可选头部是一个长度为 OPT_HEADER_LEN 字节的 RC4 数据块,内容为经过 JSON 序列化的头部。
RC4(<JSON_SERIALIZED_OPTIONAL_HEADER>)
CaRT 的数据块是一个先经 zlib 压缩、再进行 RC4 加密的数据块。
RC4(ZLIB(block encoded stream))
与可选头部类似,CaRT 的可选页脚是一个长度为 OPT_FOOTER_LEN 字节的 RC4 数据块,内容为经过 JSON 序列化的页脚。
RC4(<JSON_SERIALIZED_OPTIONAL_FOOTER>)
CaRT 文件以必需页脚结尾,该页脚使格式能够在不读取整个文件的情况下读取页脚并返回哈希值。
4s QQ Q
TRAC<RESERVED><OPT_FOOTER_LEN>
通过安装 pip 包管理器,您可以使用 CaRT 库,同时也可以使用 CaRT CLI。
CaRT CLI 的选项优先级如下:
~/.cart/cart.cfg 中的选项会覆盖默认值以下是 CaRT CLI 中可用的选项:
utilisation: cart [options] fichier1 fichier2 ... fichierN
Le format de fichier CaRT est utilisé pour enregistrer et transferer des fichiers malicieux et les métadonnées associées.
Il permet de neutraliser le fichier malicieux afin qu'il ne puisse être exécuté et l'encrypte afin d'éviter la detection et l'effacement par les anti-virus.
arguments positionels:
fichier
options:
-h, --help afficher ce message d’aide et quitter
-v, --version afficher le numéro de version du programme et quitter
-d, --delete supprime le fichier original après une exécution réussie
-f, --force remplacer le fichier de sortie s’il existe déjà
-i, --ignore Ignorer la clé RC4 dans le fichier conf
-j JSONMETA, --jsonmeta JSONMETA
Fournir les métadonnées de l’en-tête sous forme d’objet blob json
-k KEY, --key KEY Utiliser la clé RC4 privée (codé en Base64). La même clé doit être saisie pour décompresser le fichier CaRT.
-m, --meta Conserver les métadonnées lors de l’extraction des fichiers CaRT
-n FILENAME, --name FILENAME
Utiliser cette valeur comme nom de fichier des métadonnées
-o OUTFILE, --outfile OUTFILE
Définir le fichier de sortie
-s, --showmeta Afficher uniquement les métadonnées du fichier
CaRT est capable de déterminer si un fichier a besoin d'être CaRTé ou déCaRTé.
Pour CaRTer un fichier déCaRTé: cart file1
Pour déCaRTer un fichier CaRTé: cart file1
C'est la même commande!
CaRT 配置文件如下所示:
[global]
# rc4_key est une représentation en Base64 de votre clé
rc4_key: AvUzYXNkZg==
# keep_meta est un équivalent de -m dans le CLI
keep_meta: True
# force est un équivalent de -f dans le CLI
force: True
# default_header est une paire de données clé/valeur à ajouter à l’en-tête facultatif du fichier CaRT
[default_header]
poc: Votre nom
poc_email: [email protected]
CaRT 还有 Rust 和 Java 语言的实现,您可以通过以下地址访问: