From 884d655b0c9f83e3d71f255ca1250c98426e418d Mon Sep 17 00:00:00 2001 From: Terrtia Date: Thu, 31 May 2018 13:53:29 +0200 Subject: [PATCH] taxonomies and galaxies update via LAUNCH --- bin/LAUNCH.sh | 13 ++++++++++++- installing_deps.sh | 15 ++++----------- var/www/modules/Tags/Flask_Tags.py | 8 +++----- var/www/update_thirdparty.sh | 6 +++--- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index e6c12366..5a8764da 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -232,7 +232,7 @@ islogged=`screen -ls | egrep '[0-9]+.Logging_AIL' | cut -d. -f1` isqueued=`screen -ls | egrep '[0-9]+.Queue_AIL' | cut -d. -f1` isscripted=`screen -ls | egrep '[0-9]+.Script_AIL' | cut -d. -f1` -options=("Redis" "Ardb" "Logs" "Queues" "Scripts" "Killall" "Shutdown" "Update-config") +options=("Redis" "Ardb" "Logs" "Queues" "Scripts" "Killall" "Shutdown" "Update-config" "Update-thirdparty") menu() { echo "What do you want to Launch?:" @@ -332,6 +332,17 @@ for i in ${!options[@]}; do echo -e $GREEN"\t* Configuration up-to-date"$DEFAULT fi ;; + Update-thirdparty) + echo -e "\t* Updating thirdparty..." + bash -c "(cd ../var/www && ./update_thirdparty.sh)" + exitStatus=$? + if [ $exitStatus -ge 1 ]; then + echo -e $RED"\t* Configuration not up-to-date"$DEFAULT + exit + else + echo -e $GREEN"\t* Configuration up-to-date"$DEFAULT + fi + ;; esac fi done diff --git a/installing_deps.sh b/installing_deps.sh index bad6a9ce..d55fc7e3 100755 --- a/installing_deps.sh +++ b/installing_deps.sh @@ -70,10 +70,6 @@ if [ ! -f bin/packages/config.cfg ]; then cp bin/packages/config.cfg.sample bin/packages/config.cfg fi -pushd var/www/ -sudo ./update_thirdparty.sh -popd - if [ -z "$VIRTUAL_ENV" ]; then virtualenv -p python3 AILENV @@ -88,6 +84,10 @@ if [ -z "$VIRTUAL_ENV" ]; then fi +pushd var/www/ +./update_thirdparty.sh +popd + year1=20`date +%y` year2=20`date --date='-1 year' +%y` mkdir -p $AIL_HOME/{PASTES,Blooms,dumps} @@ -95,11 +95,6 @@ mkdir -p $AIL_HOME/{PASTES,Blooms,dumps} pip3 install -U pip pip3 install -U -r pip3_packages_requirement.txt -#MISP PyTaxonomies -pip3 install -U git+https://github.com/MISP/PyTaxonomies -#MISP PyMISPGalaxies -pip3 install -U git+https://github.com/MISP/PyMISPGalaxies - # Pyfaup pushd faup/src/lib/bindings/python/ python3 setup.py install @@ -107,8 +102,6 @@ popd # Py tlsh pushd tlsh/py_ext -#python setup.py build -#python setup.py install python3 setup.py build python3 setup.py install diff --git a/var/www/modules/Tags/Flask_Tags.py b/var/www/modules/Tags/Flask_Tags.py index 98a809af..01183b5a 100644 --- a/var/www/modules/Tags/Flask_Tags.py +++ b/var/www/modules/Tags/Flask_Tags.py @@ -8,6 +8,7 @@ import redis from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for import json +from datetime import datetime import Paste @@ -200,8 +201,8 @@ def get_tagged_paste(): else : return 'INCORRECT INPUT' - #currentSelectYear = int(datetime.now().year) - currentSelectYear = 2018 + #TODO FIXME + currentSelectYear = int(datetime.now().year) bootstrap_label = [] bootstrap_label.append('primary') @@ -553,9 +554,6 @@ def galaxies(): icon.append(galaxie['icon']) version.append(galaxie['version']) type = galaxie['type'] - # FIXME remove this - if type == 'mitre-pre-attack-relashipship': - type = 'mitre-pre-attack-relationship' all_type.append(type) namespace.append(galaxie['namespace']) description.append(galaxie['description']) diff --git a/var/www/update_thirdparty.sh b/var/www/update_thirdparty.sh index 7e99ebed..8f032651 100755 --- a/var/www/update_thirdparty.sh +++ b/var/www/update_thirdparty.sh @@ -66,7 +66,7 @@ wget https://www.circl.lu/assets/images/logos/AIL.png -O AIL.png popd #active virtualenv -. ./../../AILENV/bin/activate +source ./../../AILENV/bin/activate #Update MISP Taxonomies and Galaxies -pip3 install --upgrade git+https://github.com/MISP/PyTaxonomies -pip3 install --upgrade git+https://github.com/MISP/PyMISPGalaxies +python3 -m pip install git+https://github.com/MISP/PyTaxonomies +python3 -m pip install --upgrade git+https://github.com/MISP/PyMISPGalaxies