<commit_before>#!/bin/bash
#This script attempts to install the required packages for MultiScanner and its modules

CWD=`pwd`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

#Install requirements for Redhat derivatives
if [ -e /etc/redhat-release ]; then
  yum install -y epel-release
  yum install -y autoconf automake curl gcc libffi-devel libtool make python-devel python-pip ssdeep-devel tar git
fi

#Install requirements for Debian derivatives
if [ -e /etc/debian_version ]; then
  apt-get update
  apt-get install -y build-essential curl dh-autoreconf gcc libffi-dev libfuzzy-dev python-dev python-pip git libssl-dev
fi

#Install requirements for Python 2.x
if [[ $(python -V 2>&1) == Python\ 2* ]]; then
  pip install -r $DIR/requirements.txt
fi

#Install requirements for Python 3.x
if [[ $(python -V 2>&1) == Python\ 3* ]]; then
  pip install -r $DIR/requirements.txt
fi

#Code to compile and install yara
read -p "Compile yara 3.5.0? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  cd /tmp
  curl -L https://github.com/VirusTotal/yara/archive/v3.5.0.tar.gz | tar -xz
  cd yara-3.5.0
  ./bootstrap.sh
  ./configure --prefix=/usr
  make && make install
  cd yara-python
  python setup.py install
  cd ../../
  rm -rf yara-3.5.0
  ln -s /usr/lib/libyara.so.3 /lib64/libyara.so.3
  cd "$CWD"
fi

read -p "Download yararules.com signatures? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  git clone --depth 1 https://github.com/Yara-Rules/rules.git $DIR/etc/yarasigs/Yara-Rules
  echo You can update these signatures by running cd $DIR/etc/yarasigs/Yara-Rules \&\& git pull
fi

read -p "Would you like to install MultiScanner as a system library? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  pip install -e $DIR
  echo "Make sure users have access to $DIR"
fi<commit_msg>Update install script<commit_after>#!/bin/bash
#This script attempts to install the required packages for MultiScanner and its modules

CWD=`pwd`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

#Install requirements for Redhat derivatives
if [ -e /etc/redhat-release ]; then
  yum install -y epel-release
  yum install -y autoconf automake curl gcc libffi-devel libtool make python-devel ssdeep-devel tar git unzip openssl-devel file-devel
fi

#Install requirements for Debian derivatives
if [ -e /etc/debian_version ]; then
  apt-get update
  apt-get install -y build-essential curl dh-autoreconf gcc libffi-dev libfuzzy-dev python-dev git libssl-dev unzip libmagic-dev
fi

#Install requirements for Python
curl -k https://bootstrap.pypa.io/get-pip.py | python
pip install --upgrade -r $DIR/requirements.txt


#Code to compile and install yara
YARA_VER=3.5.0
read -p "Compile yara $YARA_VER? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  #Because apparently the one in the repos does not work...
  curl -L https://github.com/akheron/jansson/archive/v2.10.tar.gz | tar -xz
  cd jansson-2.10
  autoreconf -fi
  ./configure --prefix=/usr
  make install
  cd ..
  rm -rf jansson-2.10
  ln -s /usr/lib/libjansson.so.4 /lib64/libjansson.so.4
  #We get yara-python as well
  git clone -b v$YARA_VER https://github.com/VirusTotal/yara-python.git
  cd yara-python
  git clone -b v$YARA_VER https://github.com/VirusTotal/yara.git
  cd yara
  ./bootstrap.sh
  ./configure --prefix=/usr --enable-magic --enable-cuckoo --with-crypto
  make && make install
  cd ../
  python setup.py build --dynamic-linking
  python setup.py install
  cd ../
  rm -rf yara-python
  ln -s /usr/lib/libyara.so.3 /lib64/libyara.so.3
fi

read -p "Download yararules.com signatures? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  git clone --depth 1 https://github.com/Yara-Rules/rules.git $DIR/etc/yarasigs/Yara-Rules
  echo You can update these signatures by running cd $DIR/etc/yarasigs/Yara-Rules \&\& git pull
fi

read -p "Would you like to install MultiScanner as a system library? <y/N> " prompt
if [[ $prompt == "y" ]]; then
  pip install -e $DIR
  echo "Make sure users have access to $DIR"
fi
{'fraction_non_alphanumeric': 0.13070905879384304, 'fraction_numerical': 0.012112036336109008, 'mean_word_length': 3.3086956521739133, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1003366', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1388, 'n_words': 463}