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 :  /lib/udev/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/udev/write_net_rules
#!/bin/sh -e

source /etc/eni_utils/eni-helper

UDEV_RULES_PATH1=/etc/udev/rules.d

eni_log 'write_net_rules: enter write_net_rules'

if [ -n "$UDEV_LOG" ]; then
	if [ "$UDEV_LOG" -ge 7 ]; then
		set -x
	fi
fi

RULES_FILE=${UDEV_RULES_PATH1}/70-persistent-net.rules

. /lib/udev/rule_generator.functions

interface_name_taken() {
	local value="$(find_all_rules 'NAME=' $INTERFACE)"
	if [ "$value" ]; then
		return 0
	else
		return 1
	fi
}

find_next_available() {
	raw_find_next_available "$(find_all_rules 'NAME=' "$1")"
}

write_rule() {
	eni_log 'write_net_rules: enter write_rule'
	eni_log "write_net_rules: RULES_FILE:  $RULES_FILE"
	local match="$1"
	local name="$2"
	local comment="$3"

	{
	if [ "$PRINT_HEADER" ]; then
		PRINT_HEADER=
		echo "# This file was automatically generated by the $0"
		echo "# program, run by the persistent-net-generator.rules rules file."
		echo "#"
		echo "# You can modify it, as long as you keep each rule on a single"
		echo "# line, and change only the value of the NAME= key."
	fi

	echo ""
	[ "$comment" ] && echo "# $comment"
	echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\""
	} >> $RULES_FILE
}

eni_log "write_net_rules: before check interface: $INTERFACE"
if [ -z "$INTERFACE" ]; then
	echo "missing \$INTERFACE" >&2
	exit 1
fi

# Prevent concurrent processes from modifying the file at the same time.
#fix me
lock_rules_file

eni_log "write_net_rules: after calling lock_rules_file: interface: $INTERFACE"

# Check if the rules file is writeable.
choose_rules_file

eni_log "write_net_rules: after calling choose_rule_file: interface $INTERFACE"

# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces
if [ "$MATCHADDR" ]; then
	match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\""
fi
eni_log 'write_net_rules: 111'

if [ "$MATCHDRV" ]; then
	match="$match, DRIVERS==\"$MATCHDRV\""
fi
eni_log 'write_net_rules: 222'

if [ "$MATCHDEVID" ]; then
	match="$match, ATTR{dev_id}==\"$MATCHDEVID\""
fi
eni_log 'write_net_rules: 333'

if [ "$MATCHID" ]; then
	match="$match, KERNELS==\"$MATCHID\""
fi
eni_log 'write_net_rules: 444'

if [ "$MATCHIFTYPE" ]; then
	match="$match, ATTR{type}==\"$MATCHIFTYPE\""
fi
eni_log "write_net_rules: 555 match ${match}"

if [ -z "$match" ]; then
	echo "missing valid match" >&2
	#fix me
	unlock_rules_file
	exit 1
fi
eni_log 'write_net_rules: 666'

basename=${INTERFACE%%[0-9]*}
match="$match, KERNEL==\"$basename*\""

eni_log "write_net_rules: basename: ${basename} match: ${match}"

if [ "$INTERFACE_NAME" ]; then
	# external tools may request a custom name
	COMMENT="$COMMENT (custom name provided by external tool)"
	if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then
		INTERFACE=$INTERFACE_NAME;
		echo "INTERFACE_NEW=$INTERFACE"
	fi
else
	# if a rule using the current name already exists, find a new name
	if interface_name_taken; then
		INTERFACE="$basename$(find_next_available "$basename[0-9]*")"
		# prevent INTERFACE from being "eth" instead of "eth0"
		[ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0
		echo "INTERFACE_NEW=$INTERFACE"
	fi
fi

eni_log "write_net_rules: calling write_rules, INTERFACE: $INTERFACE"

write_rule "$match" "$INTERFACE" "$COMMENT"

#fix me
unlock_rules_file

eni_log 'write_net_rules: leave write_net_rules'

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit