403Webshell
Server IP : 39.106.62.82  /  Your IP : 216.73.216.223
Web Server : nginx/1.14.1
System : Linux iz2ze1m0zmp2dk5c3j5ap5z 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /etc/eni_utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /etc/eni_utils/eni-function
# This file provides functions to network scripts that source it.

#set -x

source /etc/eni_utils/eni-helper

INTERFACE_CONF_PATH=/etc/sysconfig/network-scripts

# Set up a default search path.
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
export PATH

# metadata query requires an interface and hardware address
if [ -z "${INTERFACE}" ]; then
	exit
fi
HWADDR=$(cat /sys/class/net/${INTERFACE}/address 2>/dev/null)
if [ -z "${HWADDR}" ] && [ "${ACTION}" != "remove" ]; then
	exit
fi
export HWADDR

config_file="${INTERFACE_CONF_PATH}/ifcfg-${INTERFACE}"

# make no changes to unmanaged interfaces
if [ -s ${config_file} ]; then
	unmanaged=$(LANG=C grep -l "^[[:space:]]*EC2SYNC=no\([[:space:]#]\|$\)" $config_file)
	if [ "${config_file}" == "${unmanaged}" ]; then
		exit
	fi
fi

remove_primary() {
	if [ "${INTERFACE}" == "eth0" ]; then
		return
	fi
	rm -f ${config_file}
}

rewrite_primary() {
	if [ "${INTERFACE}" == "eth0" ]; then
		return
	fi
	eni_log "eni-function: rewrite_primary: device: ${INTERFACE}, hwaddr: ${HWADDR}"

	if [[ -s $config_file ]] ; then
		cfg_hwaddr=$(awk -F'=' '/^HWADDR=.*/ {print $NF}' $config_file)
		if [[ $cfg_hwaddr != $HWADDR ]]; then
			eni_log "eni-function: rewrite_primary: device ${INTERFACE} real HWADDR ${HWADDR} not match with config file persistent HWADDR ${cfg_hwaddr}"
			return
		fi
	fi

	cat <<- EOF > ${config_file}
	DEVICE=${INTERFACE}
	BOOTPROTO=dhcp
	ONBOOT=yes
	TYPE=Ethernet
	USERCTL=yes
	PEERDNS=no
	IPV6INIT=no
	PERSISTENT_DHCLIENT=yes
	HWADDR=${HWADDR}
	DEFROUTE=no
	EOF
}

remove_rules() {
	ip=""
	filename=`ps aux |grep dhclient |grep ${INTERFACE} | egrep " -lf /.*\.leases " -o |awk '{print $2'}`
	eni_log "eni-function: remove_rules, filename: $filename"
	while read -r line
	do
		name=${line}
		tmpip=`echo $name |grep "fixed-address" | egrep "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" -o`
		if [ -n "$tmpip" ]; then
			ip=$tmpip
		fi
	done < "$filename"

	# Delete ip rules, if they exist
	eni_log "eni-function: out of the loop, ip is $ip"
	if [ -n "$ip" ]; then
		for ruleid in $(ip rule list | egrep "from ${ip}" | awk -F: '{print $1}'); do
			ip rule del pref ${ruleid};
		done
	fi
}

plug_interface() {
	eni_log 'eni-function: enter plug_interface'
	rewrite_primary
	eni_log 'eni-function: leave plug_interface'
}

unplug_interface() {
	remove_rules
	# Can't remove the config file, as ifdown need read this config file.
	#remove_primary
}

activate_primary() {
	/sbin/ifup ${INTERFACE}
}

deactivate_primary() {
	/sbin/ifdown ${INTERFACE}
}

#set +x

Youez - 2016 - github.com/yon3zu
LinuXploit