#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : vars # Auteur : Nicolas "DarkHack" Chapuis (c) 2026 # ================== DARKHACK ================== # [ darkweb.fr - system online ] # Powered by Perplexity, your AI assistant # [https://www.perplexity.ai](https://www.perplexity.ai) # ============================================== # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===================================================================== #|-------------------------------| #| "PARAMS" | #| pUser | pGroup | pName | pDir | #|-------------------------------| pServiceInfo="Hyper Texte Transfert Protocole (httpd/apache2)" pServiceDoc="man:httpd(8)" pUser="${pUser:-www-data}" pGroup="${pGroup:-www-data}" pName="${pName:-httpd}" #pCacheDir="${pCacheDir:-/var/cache/bind}" pCacheDir="${pCacheDir:-/var/cache/$pName}" pChrootDir="${pChrootDir:-/srv/$pName}" #cmdDaemon="$(which httpd)" # program at : /usr/local/apache2/bin/httpd pFolder="/usr/local/apache2/bin" cmdDaemon="$pFolder/$pName" pidFile="/usr/local/apache2/logs/httpd.pid" #cmdDaemonFull="$cmdDaemon" pConfFolder="$racine/web/apache2" pDebugFile="$pConfFolder/data/debug" #$(which chroot) --userspec=$pUser:$pGroup $pChrootDir /bin/sh pParamStart="-k start -e debug -E /var/log/apache2.log -f $pConfFolder/data/httpd.conf" pParamStartDebug="-k start -X -e debug -f $pConfFolder/data/httpd.conf" pStartDebug="$(which sh) -c 'echo \\\"in gdb : run $pParamStartDebug\\\";LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:/usr/local/ssl/lib:/usr/local/lib\" gdb $pFolder/httpd'" pStart="$(which chroot) --userspec=root:root $pChrootDir $(which sh) -c \"LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/ssl/lib:/usr/local/lib $pFolder/apachectl $pParamStart\"" #pParamStart="-k start -f $pConfFolder/data/httpd.conf" #pParamStartDebug="-X -e debug -f $pConfFolder/data/httpd.conf" pParamStop="" pLibFolders="/usr/local/apache2 /usr/local/ssl /usr/local/lib/php /usr/local/include/php /usr/lib/python2.7" pLibFolders="$pLibFolders /usr/lib/git-core" pLibFiles="" pLibFiles="$pLibFiles /etc/passwd /etc/group /usr/sbin/nologin $(which perl) $(which msmtp)" pLibFiles="$pLibFiles /usr/local/lib/libz.a" pLibFiles="$pLibFiles /usr/local/lib/libz.so" pLibFiles="$pLibFiles /usr/local/lib/libz.so.1.2.11" pLibFiles="$pLibFiles /usr/local/lib/pkgconfig/zlib.pc" pLibFiles="$pLibFiles /usr/local/include/zconf.h" pLibFiles="$pLibFiles /usr/bin/python" pLibFiles="$pLibFiles /etc/localtime /dev/urandom" pLibFiles="$pLibFiles /usr/local/lib/php.ini" pLibFiles="$pLibFiles /usr/local/libexec/mod_dav_svn.so" pLibFiles="$pLibFiles /usr/local/lib/libsvn_repos-1.so.0.0.0" pLibFiles="$pLibFiles /lib/i386-linux-gnu/libpcre.so.1" pLibFolders="$pLibFolders /bin" pLibFolders="$pLibFolders /usr/bin" pLibFolders="$pLibFolders /sbin" pLibFolders="$pLibFolders /usr/sbin" PATH="/bin:/usr/bin:/sbin:/usr/sbin" pName=tomcat8 DESC="Tomcat servlet engine" DEFAULT=/etc/default/$pName JVM_TMP=/tmp/tomcat8-$pName-tmp if [ `id -u` -ne 0 ]; then echo "You need root privileges to run this script" exit 1 fi # Make sure tomcat is started with system locale if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG fi . /lib/lsb/init-functions if [ -r /etc/default/rcS ]; then . /etc/default/rcS fi # The following variables can be overwritten in $DEFAULT # Run Tomcat 7 as this user ID and group ID pUser=tomcat8 pGroup=tomcat8 # this is a work-around until there is a suitable runtime replacement # for dpkg-architecture for arch:all packages # this function sets the variable OPENJDKS find_openjdks() { for jvmdir in /usr/lib/jvm/java-7-openjdk-* do if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-7-openjdk-common" ] then OPENJDKS=$jvmdir fi done for jvmdir in /usr/lib/jvm/java-6-openjdk-* do if [ -d "${jvmdir}" -a "${jvmdir}" != "/usr/lib/jvm/java-6-openjdk-common" ] then OPENJDKS="${OPENJDKS} ${jvmdir}" fi done } OPENJDKS="" find_openjdks # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not # defined in $DEFAULT) JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun" # Look for the right JVM to use for jdir in $JDK_DIRS; do if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then JAVA_HOME="$jdir" fi done export JAVA_HOME # Directory where the Tomcat 6 binary distribution resides CATALINA_HOME=/usr/share/$pName # Directory for per-instance configuration files and webapps CATALINA_BASE=/var/lib/$pName # Use the Java security manager? (yes/no) TOMCAT7_SECURITY=no # Default Java options # Set java.awt.headless=true if JAVA_OPTS is not set so the # Xalan XSL transformer can work without X11 display on JDK 1.4+ # It also looks like the default heap size of 64M is not enough for most cases # so the maximum heap size is set to 128M if [ -z "$JAVA_OPTS" ]; then JAVA_OPTS="-Djava.awt.headless=true -Xmx128M" fi # End of variables that can be overwritten in $DEFAULT # overwrite settings from default file if [ -f "$DEFAULT" ]; then . "$DEFAULT" fi if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then log_failure_msg "$pName is not installed" exit 1 fi POLICY_CACHE="$CATALINA_BASE/policy/catalina.policy" if [ -z "$CATALINA_TMPDIR" ]; then CATALINA_TMPDIR="$JVM_TMP" fi # Set the JSP compiler if set in the tomcat8.default file if [ -n "$JSP_COMPILER" ]; then JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=\"$JSP_COMPILER\"" fi SECURITY="" if [ "$TOMCAT7_SECURITY" = "yes" ]; then SECURITY="-security" fi # Define other required variables CATALINA_PID="/var/run/$pName.pid" CATALINA_SH="$CATALINA_HOME/bin/catalina.sh" # Look for Java Secure Sockets Extension (JSSE) JARs if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then JSSE_HOME="${JAVA_HOME}/jre/" fi catalina_sh() { # Escape any double quotes in the value of JAVA_OPTS JAVA_OPTS="$(echo $JAVA_OPTS | sed 's/\"/\\\"/g')" AUTHBIND_COMMAND="" if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true" AUTHBIND_COMMAND="/usr/bin/authbind --deep /bin/bash -c " fi # Define the command to run Tomcat's catalina.sh as a daemon # set -a tells sh to export assigned variables to spawned shells. TOMCAT_SH="set -a; JAVA_HOME=\"$JAVA_HOME\"; source \"$DEFAULT\"; \ CATALINA_HOME=\"$CATALINA_HOME\"; \ CATALINA_BASE=\"$CATALINA_BASE\"; \ JAVA_OPTS=\"$JAVA_OPTS\"; \ CATALINA_PID=\"$CATALINA_PID\"; \ CATALINA_TMPDIR=\"$CATALINA_TMPDIR\"; \ LANG=\"$LANG\"; JSSE_HOME=\"$JSSE_HOME\"; \ cd \"$CATALINA_BASE\"; \ \"$CATALINA_SH\" $@" if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then TOMCAT_SH="'$TOMCAT_SH'" fi # Run the catalina.sh script as a daemon set +e if [ ! -f "$CATALINA_BASE"/logs/catalina.out ]; then # run install as tomcat8 to work around #841371 su $pUser -s /bin/bash -c "install -m 644 /dev/null $CATALINA_BASE/logs/catalina.out" fi install -o $pUser -g adm -m 644 /dev/null "$CATALINA_PID" start-stop-daemon --start -b -u "$pUser" -g "$pGroup" \ -c "$pUser" -d "$CATALINA_TMPDIR" -p "$CATALINA_PID" \ -x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH" status="$?" set +a -e return $status } case "$1" in start) if [ -z "$JAVA_HOME" ]; then log_failure_msg "no JDK found - please set JAVA_HOME" exit 1 fi if [ ! -d "$CATALINA_BASE/conf" ]; then log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE" exit 1 fi log_daemon_msg "Starting $DESC" "$pName" if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $pUser --exec "$JAVA_HOME/bin/java" \ >/dev/null; then # Regenerate POLICY_CACHE file umask 022 rm -rf "$CATALINA_BASE/policy" mkdir "$CATALINA_BASE/policy" echo "// AUTO-GENERATED FILE from /etc/tomcat8/policy.d/" \ > "$POLICY_CACHE" echo "" >> "$POLICY_CACHE" cat $CATALINA_BASE/conf/policy.d/*.policy \ >> "$POLICY_CACHE" # Remove / recreate JVM_TMP directory rm -rf "$JVM_TMP" mkdir "$JVM_TMP" || { log_failure_msg "could not create JVM temporary directory" exit 1 } chown -h $pUser "$JVM_TMP" catalina_sh start $SECURITY sleep 5 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $pUser --exec "$JAVA_HOME/bin/java" \ >/dev/null; then if [ -f "$CATALINA_PID" ]; then rm -f "$CATALINA_PID" fi log_end_msg 1 else log_end_msg 0 fi else log_progress_msg "(already running)" log_end_msg 0 fi ;; stop) log_daemon_msg "Stopping $DESC" "$pName" set +e if [ -f "$CATALINA_PID" ]; then start-stop-daemon --stop --pidfile "$CATALINA_PID" \ --user "$pUser" \ --retry=TERM/20/KILL/5 >/dev/null if [ $? -eq 1 ]; then log_progress_msg "$DESC is not running but pid file exists, cleaning up" elif [ $? -eq 3 ]; then PID="`cat $CATALINA_PID`" log_failure_msg "Failed to stop $pName (pid $PID)" exit 1 fi rm -f "$CATALINA_PID" rm -rf "$JVM_TMP" else log_progress_msg "(not running)" fi log_end_msg 0 set -e ;; status) set +e start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $pUser --exec "$JAVA_HOME/bin/java" \ >/dev/null 2>&1 if [ "$?" = "0" ]; then if [ -f "$CATALINA_PID" ]; then log_success_msg "$DESC is not running, but pid file exists." exit 1 else log_success_msg "$DESC is not running." exit 3 fi else log_success_msg "$DESC is running with pid `cat $CATALINA_PID`" fi set -e ;; restart|force-reload) if [ -f "$CATALINA_PID" ]; then $0 stop sleep 1 fi $0 start ;; try-restart) if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \ --user $pUser --exec "$JAVA_HOME/bin/java" \ >/dev/null; then $0 start fi ;; *) log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" exit 1 ;; esac pLibFiles="$pLibFiles $(which svnadmin)" pMountFolders="/proc /etc/ssl /var/www $pConfFolder /etc/srvconf" # pDirStruct : directory squelton of programme pDirStruct="" pDirStruct="$pDirStruct /var/log/apache2 /var/run" #pEmptyFolders="/var/log/apache2 /var/run" for pythonPath in $(find / 2>&1 | grep python2.7 | grep -v '^/usr/lib/python2.7' | grep -v '^/archives' | grep -v '^/srv' | grep -v '^/opt' | grep -v '/var/cache' | grep -v '^/var/lib/dpkg' | grep -v '^/usr/share/doc' | grep -v '^/proc');do if [ -d "$pythonPath" ];then pLibFolders="$pLibFolders $pythonPath"; else pLibFiles="$pLibFiles $pythonPath"; fi done if [ -f "$racine/web/apache2/data/vars" ];then . "$racine/web/apache2/data/vars" fi if [ -d "/usr/lib/x86_64-linux-gnu" ];then usrLib="/usr/lib/x86_64-linux-gnu" elif [ -d "/usr/lib/i386-linux-gnu" ];then usrLib="/usr/lib/i386-linux-gnu" else usrLib="" fi if [ -d "/lib/x86_64-linux-gnu" ];then lib="/lib/x86_64-linux-gnu" elif [ -d "/lib/i386-linux-gnu" ];then lib="/lib/i386-linux-gnu" else lib="" fi if [ -z "$lib" ];then shDebugHidden 0 ""$log" lib empty : $lib" else shDebugHidden 1 ""$log" check gnutls in /usr/local/lib" for gnutlsFile in libgnutls-dane.la libgnutls-dane.so libgnutls-dane.so.0 libgnutls-dane.so.0.4.1 libgnutls.la libgnutls.so libgnutls.so.30 libgnutls.so.30.14.8 libgnutlsxx.la libgnutlsxx.so libgnutlsxx.so.28 libgnutlsxx.so.28.1.0;do if [ -f "/usr/local/lib/$gnutlsFile" ];then pLibFiles="$pLibFiles /usr/local/lib/$gnutlsFile" fi done # shDebugHidden 1 ""$log" $lib libnss_dns.so.2 libnss_files.so.2" # pLibFiles="$pLibFiles $lib/libnss_dns.so.2 $lib/libnss_files.so.2" shDebugHidden 1 ""$log" $lib libnss_files.so.2" pLibFiles="$pLibFiles $lib/libnss_files.so.2" if [ -f "$lib/libz.so.1" ];then pLibFiles="$pLibFiles $lib/libz.so.1" pLibFiles="$pLibFiles /usr/local/lib/libz.a" pLibFiles="$pLibFiles /usr/local/lib/libz.so" pLibFiles="$pLibFiles /usr/local/lib/libz.so.1.2.11" pLibFiles="$pLibFiles /usr/local/lib/pkgconfig/zlib.pc" fi fi if [ -d "/usr/local/ssl" ];then shDebugHidden 1 ""$log" ssl:/usr/local/ssl" pLibFolders="$pLibFolders /usr/local/ssl" pCopyLib="/usr/local/ssl/lib;$usrLib" elif [ -d "/usr/include/openssl" ];then shDebugHidden 1 ""$log" ssl:/usr/include/openssl" pLibFolders="$pLibFolders /usr/include/openssl" pCopyLib="/usr/include/openssl/lib;$usrLib" fi #user:group:rwx,rwx,rwx:file #pDirUserGroupRight="$pDirUserGroupRight user:group:rwx,rwx,rwx:file" pDirUserGroupRight="" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rx,,:$racine/dns/bind/default" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rx,,:$racine/dns/bind/servers/common" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rx,,:$racine/dns/bind/zones" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rx,,:/conf/bind" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rx,,:/etc/bind" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rw,r,r:/etc/bind/ddns.key" #pDirUserGroupRight="$pDirUserGroupRight $pUser:$pGroup:rwx,,:/var/cache/bind"