From 90b6f43468efeec5d476f876b58496ddc5f8853d Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 7 Jun 2021 16:46:29 +0200 Subject: [PATCH] chg: [update v3.6 + installer] fix faup install + add v3.6 update --- install_virtualenv.sh | 18 ++++++++++++++++-- installing_deps.sh | 4 ++++ requirements.txt | 4 ++++ update/v3.6/Update.py | 26 ++++++++++++++++++++++++++ update/v3.6/Update.sh | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100755 update/v3.6/Update.py create mode 100755 update/v3.6/Update.sh diff --git a/install_virtualenv.sh b/install_virtualenv.sh index aa97b7cc..c0e5b28b 100755 --- a/install_virtualenv.sh +++ b/install_virtualenv.sh @@ -18,8 +18,22 @@ if [ -z "$VIRTUAL_ENV" ]; then fi -# activate virtual environment -. ./AILENV/bin/activate +if [ ! -z "$TRAVIS" ]; then + echo "Travis detected" + ENV_PY="~/virtualenv/python3.6/bin/python" + export AIL_VENV="~/virtualenv/python3.6/" + + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd |sed 's/bin//' )" + export AIL_HOME="${DIR}" + + export AIL_BIN=${AIL_HOME}/bin/ + export AIL_FLASK=${AIL_HOME}/var/www/ + export AIL_REDIS=${AIL_HOME}/redis/src/ + export AIL_ARDB=${AIL_HOME}/ardb/src/ +else + # activate virtual environment + . ./AILENV/bin/activate +fi pip3 install -U pip pip3 install 'git+https://github.com/D4-project/BGP-Ranking.git/@7e698f87366e6f99b4d0d11852737db28e3ddc62#egg=pybgpranking&subdirectory=client' diff --git a/installing_deps.sh b/installing_deps.sh index 4206d48c..6cb1881e 100755 --- a/installing_deps.sh +++ b/installing_deps.sh @@ -63,6 +63,10 @@ sudo make install echo '/usr/local/lib' | sudo tee -a /etc/ld.so.conf.d/faup.conf sudo ldconfig popd +# Pyfaup +pushd faup/src/lib/bindings/python/ +python3 setup.py install +popd # tlsh test ! -d tlsh && git clone https://github.com/trendmicro/tlsh.git diff --git a/requirements.txt b/requirements.txt index 57f1a42e..0b0f7173 100644 --- a/requirements.txt +++ b/requirements.txt @@ -88,3 +88,7 @@ pylibinjection # Graph matplotlib + +# Test +nose +coverage diff --git a/update/v3.6/Update.py b/update/v3.6/Update.py new file mode 100755 index 00000000..a2ac201b --- /dev/null +++ b/update/v3.6/Update.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*-coding:UTF-8 -* + +import os +import re +import sys +import time +import redis +import datetime + +sys.path.append(os.path.join(os.environ['AIL_BIN'], 'lib/')) +import ConfigLoader + +sys.path.append(os.path.join(os.environ['AIL_HOME'], 'update', 'bin')) +from ail_updater import AIL_Updater + +class Updater(AIL_Updater): + """default Updater.""" + + def __init__(self, version): + super(Updater, self).__init__(version) + +if __name__ == '__main__': + + updater = Updater('v3.6') + updater.run_update() diff --git a/update/v3.6/Update.sh b/update/v3.6/Update.sh new file mode 100755 index 00000000..e82dba98 --- /dev/null +++ b/update/v3.6/Update.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +[ -z "$AIL_HOME" ] && echo "Needs the env var AIL_HOME. Run the script from the virtual environment." && exit 1; +[ -z "$AIL_REDIS" ] && echo "Needs the env var AIL_REDIS. Run the script from the virtual environment." && exit 1; +[ -z "$AIL_ARDB" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1; +[ -z "$AIL_BIN" ] && echo "Needs the env var AIL_ARDB. Run the script from the virtual environment." && exit 1; +[ -z "$AIL_FLASK" ] && echo "Needs the env var AIL_FLASK. Run the script from the virtual environment." && exit 1; + +export PATH=$AIL_HOME:$PATH +export PATH=$AIL_REDIS:$PATH +export PATH=$AIL_ARDB:$PATH +export PATH=$AIL_BIN:$PATH +export PATH=$AIL_FLASK:$PATH + +GREEN="\\033[1;32m" +DEFAULT="\\033[0;39m" + +echo -e $GREEN"Shutting down AIL ..."$DEFAULT +bash ${AIL_BIN}/LAUNCH.sh -ks +wait + +# SUBMODULES # +git submodule update + +echo -e $GREEN"Updating D4 CLIENT ..."$DEFAULT +pip3 install -U d4-pyclient + +echo "" +echo -e $GREEN"Installing nose ..."$DEFAULT +pip3 install -U nose + +echo -e $GREEN"Installing coverage ..."$DEFAULT +pip3 install -U coverage + +echo "" +echo -e $GREEN"Updating DomainClassifier ..."$DEFAULT +pip3 install -U DomainClassifier + +exit 0