fix: [Launcher] fix virtualenv loader

This commit is contained in:
Terrtia 2020-09-03 14:38:17 +02:00
parent 4a0613e3c9
commit 55ab603f27
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 8 additions and 12 deletions

View file

@ -18,23 +18,21 @@ cd ${AIL_HOME}
if [ -e "${DIR}/AILENV/bin/python" ]; then if [ -e "${DIR}/AILENV/bin/python" ]; then
ENV_PY="${DIR}/AILENV/bin/python" ENV_PY="${DIR}/AILENV/bin/python"
export AIL_VENV=${AIL_HOME}/AILENV/ export AIL_VENV=${AIL_HOME}/AILENV/
. ./AILENV/bin/activate
elif [ ! -z "$TRAVIS" ]; then elif [ ! -z "$TRAVIS" ]; then
echo "Travis detected" echo "Travis detected"
ENV_PY="~/virtualenv/python3.6/bin/python" ENV_PY="~/virtualenv/python3.6/bin/python"
export AIL_VENV="~/virtualenv/python3.6/" export AIL_VENV="~/virtualenv/python3.6/"
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 else
echo "Please make sure you have a AIL-framework environment, au revoir" echo "Please make sure you have a AIL-framework environment, au revoir"
exit 1 exit 1
fi fi
# redis-server is bundled during install
## [ ! -f "`which redis-server`" ] && echo "'redis-server' is not installed/not on PATH. Please fix and run again." && exit 1
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/
export PATH=$AIL_VENV/bin:$PATH export PATH=$AIL_VENV/bin:$PATH
export PATH=$AIL_HOME:$PATH export PATH=$AIL_HOME:$PATH
export PATH=$AIL_REDIS:$PATH export PATH=$AIL_REDIS:$PATH

View file

@ -103,13 +103,11 @@ def is_valid_default_yara_rule(yara_rule):
yara_dir = get_yara_rules_default_dir() yara_dir = get_yara_rules_default_dir()
filename = os.path.join(yara_dir, yara_rule) filename = os.path.join(yara_dir, yara_rule)
filename = os.path.realpath(filename) filename = os.path.realpath(filename)
print(yara_dir)
print(filename)
# incorrect filename # incorrect filename
if not os.path.commonprefix([filename, yara_dir]) == yara_dir: if not os.path.commonprefix([filename, yara_dir]) == yara_dir:
print('error: file transversal') print('error: file transversal')
print(yara_dir)
print(filename)
return False return False
else: else:
if os.path.isfile(filename): if os.path.isfile(filename):