KoreLogic Blog
Building FTimes With Python3 2019-04-25 11:10

This is the next part in a series of blog posts focusing on the open-source tool FTimes. This blog post will demonstrate building FTimes with XMagic and an embedded Python interpreter. In so doing, FTimes will be able to perform more complex searches by utilizing file hooks.

For this exercise, we will be using Devuan Linux as our build environment.

One prerequisite for building FTimes with XMagic requires PCRE and associated development libraries. Users can install this on Devuan and other Debian based systems using:

sudo apt-get install libpcre3 libpcre3-dev

Note that Python2 can be substituted for Python3, if desired.

Since we are embedding python3 into FTimes, the Python development libraries will also need to be installed:

sudo apt-get install python3-dev

Next untar the FTimes tarball and change into the ftimes-3.12.0 source directory:

tar -zxf ftimes-3.12.0.tgz
cd ftimes-3.12.0

Create a work directory (e.g., "b" for build). This is where you will build ftimes. We prefer to create/use a separate work directory so that configuration changes can be made easily without disturbing the source directories. It also makes cleanup a breeze (i.e., a simple directory remove restores the project to its original state).

mkdir b
cd b

Next, run the configure script providing it the necessary options for building the Python interpreter along with all associated FTimes tools.

../configure --with-all-tools --with-python=`which python3`
make install

In the above command the backticks (`) are used via your shell to determine where the python3 binary is installed on the build system. The full path to the python3 binary (e.g., "/usr/bin/python3") can also be used.

You can now verify that your FTimes executable has been built with Python embedded in it by running:

ftimes --version
The output should look similar to this:
ftimes 3.12.0 64-bit pcre(8.39),python(3.5.3),xmagic

Now that Python has been embedded in the executable, you can use its interpreter to implement file hooks (via the FileHooks control), which incorporate and utilize the KLEL library. An upcoming blog post in this series will delve into that. We hope you stay tuned.

0 comments Posted by Jay at: 11:10 permalink

Comments are closed for this story.