403Webshell
Server IP : 104.21.84.107  /  Your IP : 104.23.197.208
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /sbin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /sbin/kexec-load-kernel
#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NOKEXECFILE=/no-kexec-reboot

. /lib/lsb/init-functions

test -r /etc/default/kexec && . /etc/default/kexec
if [ -d /etc/default/kexec.d ] ; then
	for snippet in $(run-parts --list /etc/default/kexec.d) ; do
		. "$snippet"
	done
fi

process_grub_entry() {
	initrd_image=
	while read command args; do
		if [ "$command" = "linux" ]; then
			echo "$args" | while read kernel append; do
			echo KERNEL_IMAGE=\"${prefix}${kernel}\"
			echo APPEND=\"${append}\"
			done
		elif [ "$command" = "initrd" ]; then
			initrd_image=${prefix}${args}
		fi
	done
	echo INITRD=\"$initrd_image\"
}

get_grub_kernel() {
	test -f /boot/grub/grub.cfg || return
	local prefix
	mountpoint -q /boot && prefix=/boot || prefix=
	data=$(cat /boot/grub/grub.cfg)

	default=$(echo "$data" | awk '/set default/ {print $2}' | cut -d'"' -f2 | tail -1)
	if [ "$default" = '${saved_entry}' ]; then
		default=$(sed -ne 's/^saved_entry=//p' /boot/grub/grubenv)
	fi
	if [ -z "$default" ]; then
		default=0
	fi
	start_offset=$((default + 1))
	end_offset=$((default + 2))

	# grub entries start with "menuentry" commands.  Get the line
	# numbers that surround the first entry
	offsets=$(echo "$data" | grep -n '^[[:space:]]*menuentry[[:space:]]' | cut -d: -f1)
	begin=$(echo "$offsets" | tail -n+$start_offset | head -n1)
	end=$(echo "$offsets" | tail -n+$end_offset | head -n1)

	# If this is the last entry, we need to read to the end of the file
	# or to the end of boot entry section
	if [ -z "$end" ]; then
		numlines=$(echo "$data" | tail --lines=+$begin | grep -n "^### END" | head -1 | cut -d: -f1)
		end=$((begin + numlines - 1))
	fi

	length=$((end - begin))
	entry=$(echo "$data" | tail -n+$begin | head -n$length)
	eval $(echo "$entry" | process_grub_entry)
}

load_kernel () {
	test -x /sbin/kexec || exit 0
	test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" && exit 0

	if [ -f $NOKEXECFILE ]
	then
		/bin/rm -f $NOKEXECFILE
		exit 0
	fi

	test "$USE_GRUB_CONFIG" = "true" && get_grub_kernel

	REAL_APPEND="$APPEND"

	test -z "$REAL_APPEND" && REAL_APPEND="`cat /proc/cmdline`"
	echo "Loading new kernel image into memory"
	if [ -z "$INITRD" ]
	then
		/sbin/kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
	else
		/sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
	fi
	echo "kexec kernel loaded"
}

load_kernel
exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit