Manipulating, deleting metadata files

Posted on Jul 1, 2024

exiftool

exiftool is a tool to display and update metadata in a file.

git clone https://github.com/exiftool/exiftool.git
cd exiftool

Alternatively, on deb distributions you can use the following command:

sudo apt install -y libimage-exiftool-perl

I’m gonna use a example.pdf file as an example. The follow exiftool command without any options will give you a list of the fields in the file.

exiftool example.pdf

To delete metadata of the example.pdf file use -all= option as shown below:

exiftool -all= example.pdf

For deleting metadata from entire directory use the exiftool -recurse -all= <path-of-directory> command.

You can also change the fields of the file or overwrite the information in them.

exiftool Author= example.pdf
exiftool Author=Tom example.pdf

To restore the fields of the file use -pdf-update:all= option.

exiftool -pdf-update:all= example.pdf

QPDF

QPDF is a program that can be used to linearize (web-optimize), encrypt (password-protect), decrypt, and inspect PDF files from the command-line.

sudo apt install -y qpdf

The -pdf-update:all= option of exiftool recover the deletion of fields. Even if you deleted the example.pdf_original file. In some cases the recovery of deleted fields is a problem, you can use qpdf after deleting.

exiftool –all= example.pdf
qpdf --linearize --replace-input example.pdf

exiftool -pdf-update:all= example.pdf
Error: File contains no previous ExifTool update - example.pdf
    0 image files updated
    1 files weren't updated due to errors

More information can be found in the official repository: https://github.com/qpdf/qpdf.

MAT2

Python-based tool for deleting metadata for different file types.

sudo install -y mat2

To display a list of supported formats, use mat2 -l command.

Use mat2 --show example.pdf to list harmful metadata detectable by mat2 without removing them.

Note: MAT2 will not clean files in-place, but will produce, for example, with a file named myfile.png a cleaned version named myfile.cleaned.png.

The following command will delete the metadata of the example.pdf file.

mat2 example.pdf

More information about the tool can be found in the official repository: https://github.com/tpet/mat2.

Exiv2

Exiv2 is a C++ library and a command line utility to manage image metadata. It provides fast and easy read and write access to the Exif, IPTC and XMP metadata of images in various formats

sudo apt install -y exiv2
exiv2 rm example.png

ffmpeg

FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge.

sudo apt install -y ffmpeg

More information about the ffmpeg tool can be found on the official website: https://ffmpeg.org/.

FOCA

There is another tool that is called FOCA. This tool allows you to capture various files from sites, collect and analyze them.

Note: The following link provides information on how to install SQL Server Express: https://github.com/ElevenPaths/FOCA/wiki/How-to-set-up-a-SQL-database-connection.

You can find more information in the official repository: https://github.com/ElevenPaths/FOCA.

References