#!/bin/sh
# SOCFortress
# https://www.socfortress.co
# info@socfortress.co
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
WPYTHON_BIN="framework/python/bin/python3"
SCRIPT_PATH_NAME="$0"
DIR_NAME="$(cd $(dirname ${SCRIPT_PATH_NAME}); pwd -P)"
SCRIPT_NAME="$(basename ${SCRIPT_PATH_NAME})"
case ${DIR_NAME} in
  */active-response/bin | */wodles*)
    if [ -z "${WAZUH_PATH}" ]; then
      WAZUH_PATH="$(cd ${DIR_NAME}/../..; pwd)"
    fi
PYTHON_SCRIPT="${DIR_NAME}/${SCRIPT_NAME}.py"
  ;;
  */bin)
    if [ -z "${WAZUH_PATH}" ]; then
      WAZUH_PATH="$(cd ${DIR_NAME}/..; pwd)"
    fi
PYTHON_SCRIPT="${WAZUH_PATH}/framework/scripts/${SCRIPT_NAME}.py"
  ;;
  */integrations)
    if [ -z "${WAZUH_PATH}" ]; then
      WAZUH_PATH="$(cd ${DIR_NAME}/..; pwd)"
    fi
PYTHON_SCRIPT="${DIR_NAME}/${SCRIPT_NAME}.py"
  ;;
esac
${WAZUH_PATH}/${WPYTHON_BIN} ${PYTHON_SCRIPT} "$@"
