mat2 is a metadata stripping tool supporting a wide range of commonly used files (office documents, images, audio, e-books, archives, videos), written in python3. Basically, this is a library used by the command line interface of the same name and as an extension to nautilus.
Be careful, the mat2 program does not clean the files themselves, instead it creates a file with the word “cleaned” appended to its name between the name and its extension. For example, if the file is named “filename.png”, then a new file named “filename.cleaned.png” will be created.
What is metadata
Metadata is information that characterizes other information. Metadata is used to describe, document basic information. For example, in a jpg picture, the main information is the picture itself, and the metadata is information about the shooting time, camera, flash, autofocus, GPS coordinates, and so on. For a Word document, the main information is the text of the document and its formatting, and the metadata is information about the author, the time the document was created, the time of editing, the number of words, the person who made the changes, and so on.
Basically, metadata answers the who, what, when, where, why, and how questions about every aspect of the data that is being documented.
The metadata inside the file can tell a lot about you.
Cameras record data about when the photo was taken and which camera was used. Office documents such as PDF or Office automatically add author and company information to documents and spreadsheets.
It is possible that you do not want to disclose this information on the network. This is exactly the job of MAT2: getting rid of metadata as much as possible.
- application/epub+zip (.epub)
- application/pdf (.pdf)
- application/vnd.oasis.opendocument.chart (.odc)
- application/vnd.oasis.opendocument.formula (.odf)
- application/vnd.oasis.opendocument.graphics (.odg)
- application/vnd.oasis.opendocument.image (.odi)
- application/vnd.oasis.opendocument.presentation (.odp)
- application/vnd.oasis.opendocument.spreadsheet (.ods)
- application/vnd.oasis.opendocument.text (.odt)
- application/vnd.openxmlformats-officedocument.presentationml.presentation (.pptx)
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx)
- application/x-bittorrent (.torrent)
- application/x-dtbncx+xml (.ncx)
- application/x-tar (.tar)
- application/xhtml+xml (.xhtm, .xht, .xhtml)
- application/zip (.zip)
- audio/mpeg (.mp1, .mpga, .m2a, .mp2, .mp2a, .m3a, .mp3)
- audio/ogg (.ogg, .opus, .oga, .spx)
- audio/x-aiff (.aifc, .aiff, .aif)
- audio/x-flac (.flac)
- audio/x-wav (.wav)
- image/gif (.gif)
- image/jpeg (.jfif, .jpe, .jpg, .jpeg)
- image/png (.png)
- image/svg+xml (.svgz, .svg)
- image/tiff (.tif, .tiff)
- image/x-ms-bmp (.bmp)
- image/x-portable-pixmap (.ppm)
- text/css (.css)
- text/html (.htm, .html)
- text/plain (.txt, .f90, .in, .hh, .hxx, .el, .list, .text, .cc, .cxx, .pm, .conf, .def, .log)
- video/mp4 (.mp4, .mpg4, .m4v, .mp4v)
- video/x-ms-wmv (.wmv)
- video/x-msvideo (.avi)
Author: Julien Voisin
mat2 [-h] [-V] [--unknown-members policy] [--inplace] [--no-sandbox] [-v] [-l] [--check-dependencies] [-L | -s] [files ...]
positional arguments: files the files to process optional arguments: -h, --help show this help message and exit -V, --verbose show more verbose status information --unknown-members policy how to handle unknown members of archive-style files (policy should be one of: abort, omit, keep) [Default: abort] --inplace clean in place, without backup --no-sandbox Disable bubblewrap's sandboxing -v, --version show program's version number and exit -l, --list list all supported fileformats --check-dependencies check if mat2 has all the dependencies it needs -L, --lightweight remove SOME metadata -s, --show list harmful metadata detectable by mat2 without removing them
Notes on metadata discovery
While using the --show flag, MAT2 works very well to show the found metadata, if nothing is shown it does not mean that the file is clear of metadata. There is no reliable way to discover all possible metadata for complex file formats.
Therefore, you should not rely on the presence of metadata when deciding whether your file should be cleaned up or not.
Lightweight Mode Notes
By default, mat2 does its best to remove all metadata, even if the contents of the file are affected. For example, text in PDF will no longer be able to be selected, compressed images must be compressed again… Since some users do not need such strictness and they do not want mat2 to change the contents of the files, the -L flag has been added for this, which will make it so that mat2 will not change the contents of the file, but as a result, some of the metadata will not be removed.
mat2 Usage Example
Find metadata in file 20181009_115635.jpg, but do not delete it (-s):
mat2 -s 20181009_115635.jpg
Clear the photo from all metadata:
How to install mat2
Installation on Kali Linux
sudo apt install mat2
Installation on Debian, Linux Mint, Ubuntu
sudo apt update sudo apt install mat2
Installation on BlackArch
The program is pre-installed on BlackArch. To install in minimal builds run:
sudo pacman -S mat2
GUI for mat2
You can use the GUI to remove metadata. Metadata Cleaner is a GUI for mat2.
Installing Metadata Cleaner on Debian, Kali Linux, Ubuntu, Linux Mint and their derivatives:
sudo apt install metadata-cleaner
Installing Metadata Cleaner on Arch Linux, BlackArch, Manjaro and their derivatives:
Start by installing pikaur: Automatic installation and update of AUR packages.
Then run the command:
pikaur -S metadata-cleaner
After installation, you can find the program in the menu called “Metadata Cleaner”, or run it from the command line:
For details on using Metadata Cleaner see here: https://en.kali.tools/?p=1691
- Best Kali Linux tools in WSL (Windows Subsystem for Linux) (Part 2)
- How to view metadata in MS Word files. How to remove and edit Word metadata
- How to extract, delete and edit metadata in LibreOffice files
- Online service “List all the harmful metadata of a file” (mirror)