Build and Install

Requirements

Python

Python 3.9+ is required in order to properly run Thug. You may be lucky running it with previous versions but please consider such versions are not supported. Please do not report issues in such case. Python source code can be downloaded at http://www.python.org.

Python support

Thug 0.10.6 is the last version supporting Python 2.7

Thug 3.1 is the last version supporting Python 3.6

Thug 3.9 is the last version supporting Python 3.7

Thug 5.7 is the last version supporting Python 3.8

Google V8

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

STPyV8 (https://github.com/cloudflare/stpyv8/) is a Python/C++ wrapper that allows interoperability between Python 3 and JavaScript running Google’s V8 engine. STPyV8 is a fork of the original PyV8 project, with code changed to work with the latest V8 engine and Python 3. STPyV8 links with Google V8 built as a static library. Currently the library builds on Linux, MacOS and Microsoft Windows.

Recent Thug versions support just Python 3.9+. If you are installing a recent Thug version (and you should really do that) you’ll end up installing STPyV8 with no further action required.

Python 2 (DEPRECATED)

If you have some very good reasons to avoid moving to Python 3 be aware that Thug 0.10.6 is the last version supporting Python 2.7. In such case you have to install PyV8. Please consider that PyV8 is not maintained so you could experience issues. Please do not report related issues.

In order to properly install Google V8 and PyV8 please follow the procedure described below.

$ git clone https://github.com/buffer/pyv8.git
$ cd pyv8
~/pyv8 $ python setup.py build
~/pyv8 $ sudo python setup.py install

Graphviz/PyGraphviz (optional)

Graphviz homepage is located at http://www.graphviz.org/.

Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.

Packages for most Linux distributions are available.

PyGraphviz is needed just if you need analysis network graphs generation otherwise you can safely live without it. In order to install PyGraphviz just run

$ pip install 'thug[exploitgraph]'

MongoDB (optional)

MongoDB homepage is located at http://www.mongodb.org.

Packages for most Linux distributions are available.

RabbitMQ (optional)

RabbitMQ homepage is located at http://www.rabbitmq.com/. RabbitMQ is a high-performance AMQP-compliant message broker written in Erlang and it’s needed just if you want to play with Thug distributed mode.

Packages for most Linux distributions are available.

Thug installation

Starting from Thug 0.8.0, Thug is installable through pip with the following procedure

pip install thug

If you experience issues related to ssdeep while installing Thug as shown before, try the following command before reporting the issue

export BUILD_LIB=1
pip install thug

Alternatively you can clone the Thug repository and execute

$ cd thug
$ pip install .

The procedure will install the dependencies not already mentioned in the previous sections so you should take care of installing them before actually installing Thug.