| Server IP : 82.148.16.210 / Your IP : 216.73.216.19 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : root ( 0) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/set-root-pw/ |
Upload File : |
#!/bin/bash
[ -n "$_INCGD_logging" ] && return || readonly _INCGD_logging=1
log_dir="/var/log/set-root-pw"
log_filename="`basename $log_dir`.log"
log_quiet="${log_quiet:-no}"
log_level="${log_level:-8}"
_OUT_FD=2
_LOG_LEVEL_DEBUG=8
_LOG_LEVEL_INFO=4
_LOG_LEVEL_ERROR=2
_LOG_LEVEL_FATAL=1
_log_write()
{
LEVEL=$1; shift
MSG="$*"
# Check that current log level is greater or equal to message level
if [[ "$LEVEL" -gt "$log_level" ]]; then
return
fi
# Touch log file
[[ -e "${log_dir}/${log_filename}" ]] || touch "${log_dir}/${log_filename}"
if [[ -e "$log_dir" ]] && [[ -w "${log_dir}/${log_filename}" ]]; then
date=`date +'%F %T'`
echo -e "$date $MSG" | sed -r "s/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" >> "${log_dir}/${log_filename}"
fi
# Check if we should echo to console
if [[ ! "$log_quiet" =~ ^[y|t|1] ]] && [[ -t ${_OUT_FD} ]]; then
echo -e "$MSG" >&${_OUT_FD}
fi
}
debug()
{
MSG="\e[37m\e[1mDEBUG:\e[21m \e[90m$*\e[0m"
_log_write ${_LOG_LEVEL_DEBUG} "$MSG"
}
info()
{
MSG="\e[1mINFO:\e[21m $*\e[0m"
_log_write ${_LOG_LEVEL_INFO} "$MSG"
}
error()
{
MSG="\e[33m\e[1mERROR:\e[21m $*\e[0m"
_log_write ${_LOG_LEVEL_ERROR} "$MSG"
}
fatal()
{
MSG="\e[31m[\e[1mFATAL:\e[21m $*\e[0m"
_log_write ${_LOG_LEVEL_FATAL} "$MSG"
}
# Don't do anything if we're in main process
if [[ "scarlet-init" == $(basename $0) ]]; then
return 2> /dev/null || exit 0
fi
### BRAIN DAMAGE ALERT ###
# Bash FD manipulations below
# Intercept output of all called programs, and put it into logger line by line
_stdout()
{
while IFS='' read -r line; do
MSG="AUX STDOUT: $line"
_log_write $_LOG_LEVEL_DEBUG "$MSG"
done
}
_stderr()
{
while IFS='' read -r line; do
MSG="AUX STDERR: $line"
_log_write $_LOG_LEVEL_DEBUG "$MSG"
done
}
_OUT_FD=3
exec 3>&2
exec 1> >(_stdout)
exec 2> >(_stderr)