https://github.com/jlu5/fileinsight
File type identifier via libmagic and TrID.
https://github.com/jlu5/fileinsight
analysis file identifier libmagic trid type
Last synced: about 1 month ago
JSON representation
File type identifier via libmagic and TrID.
- Host: GitHub
- URL: https://github.com/jlu5/fileinsight
- Owner: jlu5
- License: lgpl-3.0
- Created: 2016-12-04T00:36:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-02T01:55:33.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T08:22:56.948Z (about 2 months ago)
- Topics: analysis, file, identifier, libmagic, trid, type
- Language: C++
- Homepage:
- Size: 63.5 KB
- Stars: 9
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# FileInsight
FileInsight is a Qt-based file type identifier using libmagic (i.e. the Unix `file` command), Qt 5, and TrID as its backends. It is written in C++ and has been tested to work on both Windows and Linux.
## Compilation / Installation
### Linux
Linux installation is fairly straightforward. For icon display, FileInsight will simply use the icon theme configured on your desktop.
1) Install Qt 5's development suite, Qt Creator, and libmagic's development files. On a Debian / Ubuntu system, this corresponds to `apt-get install qt5-default libmagic-dev qtcreator`.
2) Build the project with Qt Creator.
3) Optionally, you can download and install TrID from http://mark0.net/soft-trid-e.html (the backend works by calling it as a subprocess). TrID is free for personal and non-commercial use, but is *NOT* free as in FOSS.
### Windows
Windows builds are a pain (no, really!). Instead, you may want to simply grab a Windows build from [the releases page](https://github.com/GLolol/FileInsight/releases).
#### Getting all the required components
1) Download and install MinGW and MSYS using this guide: http://www.mingw.org/wiki/Getting_Started
2) Install Qt with MinGW from https://www.qt.io/download/..
3) Fetch the sources for [libmagic/file](https://github.com/file/file) and its dependency [libgnurx](https://github.com/glolol/libgnurx)
#### Building libmagic/file
4) Create an empty folder (prefix) to use as the prefix for building libgnurx and libmagic/file.
5) Compile libgnurx into the empty prefix you created: in a MinGW shell, navigate to the source folder and run `./configure --prefix=THE FOLDER YOU CHOSE && make && make install`
6) Compile libmagic/file into the empty prefix you created: in a MinGW shell, navigate to the source folder and run:
- `export TARGET=THE FOLDER YOU CHOSE`
- `autoreconf -f -i`
- `LDFLAGS="-L$TARGET/lib -static-libgcc" CFLAGS="-I$TARGET/include" ./configure --prefix=$TARGET`
- `make && make install`7) Now that libmagic and libgnurx have been built, copy the contents of the libmagic build folder into the `thirdparty/` directory of FileInsight's source. On Windows, this is where the toolchain will try to load its dependency libraries from.
#### Building FileInsight (MinGW)
8) You should be able to build FileInsight now using Qt Creator + MinGW. However, in order for the resulting binary to run, you must copy the following into the directory of your resultant build:
- `bin/libgnurx-0.dll` from the libmagic build
- `bin/libmagic-1.dll` from the libmagic build
- `share/misc/magic.mgc` (libmagic's data file) from the libmagic build
- `libgcc_s_dw2-1.dll` from your MinGW root (e.g. `C:\MinGW\bin`)#### Making a Redistributable Build
9) Copy the `windows-build-skeleton/` folder in FileInsight's source to somewhere else (this will be your "Windows build folder"). This folder includes the relevant copyright information that makes the build legally distributable (hopefully).
10) Use [windeployqt](https://doc.qt.io/qt-5/windows-deployment.html) to copy the required Qt libraries to the Windows build folder: in a command line, run `windeploy PATH-TO-FILEINSIGHT.EXE`.
11) Copy `libgnurx-0.dll`, `libmagic-1.dll`, `libgcc_s_dw2-1.dll`, and `magic.mgc` into the Windows build folder.
12) Optional: for TrID backend support, extract TrID from http://mark0.net/soft-trid-e.html it into the `thirdparty` directory in the Windows build folder.
13) Optional: for icon display, extract a prebuilt copy of the Oxygen icon theme (from a source like [Debian](https://packages.debian.org/sid/all/oxygen-icon-theme/download)) into the `icons/` folder. Since simple tarball extraction may create (broken) Unix symlinks, they must be expanded so that FileInsight can actually load them.
- You can use the bundled `expand-symlinks.py` in the `scripts/` folder for this purpose: `scripts/expand-symlinks.py PATH_TO_OXYGEN_ICONS`