"Hyperscan is a high-performance multiple regex matching library." https://www.hyperscan.io
"Hyperscan is a high performance regular expression matching library (...)" (https://www.intel.com/content/www/us/en/developer/articles/technical/introduction-to-hyperscan.html)
In Suricata it can be used to perform multi pattern matching (mpm). Support was implemented by Justin Viiret and Jim Xu from Intel: https://github.com/inliniac/suricata/pull/1965, https://redmine.openinfosecfoundation.org/issues/1704
In Suricata it can be used to perform multi pattern matching (mpm) or single pattern matching (spm).
Compilation
Support for hyperscan in Suricata was initially implemented by Justin Viiret and Jim Xu from Intel via https://github.com/OISF/suricata/pull/1965.
~~~~~~~~~~~
It's possible to pass --with-libhs-includes=/usr/local/include/hs/ --with-libhs-libraries=/usr/local/lib/, although by default this shouldn't be necessary. Suricata should pick up Hyperscan's pkg-config file automagically.
Hyperscan is only for Intel x86 based processor architectures at this time. For ARM processors, vectorscan is a drop in replacement for hyperscan, https://github.com/VectorCamp/vectorscan.
When Suricata's compilation succeeded, you should have:
::
Basic Installation (Package)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some Linux distributions include hyperscan in their respective package collections.
To use the hyperscan support edit your suricata.yaml. Change the mpm-algo and spm-algo values to 'hs'.
Alternatively, use this command-line option: --set mpm-algo=hs --set spm-algo=hs
Hyperscan has the following dependencies in order to build from
source:
* boost development libraries (minimum boost library version is 1.58)
* cmake
* C++ compiler (e.g. gcc-c++)
* libpcap development libraries
* pcre2 development libraries
* python3
* ragel
* sqlite development libraries
**Note:** git is an additional dependency if cloning the
hyperscan GitHub repository. Otherwise downloading the
hyperscan zip from the GitHub repository will work too.
The steps to build and install hyperscan are:
Ubuntu Hyperscan Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To use Suricata with Hyperscan support, install dependencies:
::
::
apt-get install cmake ragel
libboost headers
----------------
Hyperscan needs the libboost headers from 1.58+.
On Ubuntu 15.10 or 16.04+, simply do:
::
apt-get install libboost-dev
Trusty
------
Trusty has 1.57, so it's too old. We can grab a newer libboost version, but we *don't* install it system wide. It's only the headers we care about during compilation of Hyperscan.