⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lnsk

📁 An easy, yet highly-configurable iptables-based firewall solution designed for everybody from home u
💻
字号:
#!/bin/sh#################################################################################                                                                              ##                        Linux Network Solution Kit                            ##                                                                              ## Author: Scott Duckworth                                                      ## E-mail: bikingduck@users.sourceforge.net                                     ##                                                                              ## Copyright (C) 2002                                                           ##                                                                              ## This program is free software; you can redistribute it and/or modify it      ## under the terms of the GNU General Public License as published by the Free   ## Software Foundation; either version 2 of the License, or (at your option)    ## any later version.                                                           ##                                                                              ## This program is distributed in the hope that it will be useful, but WITHOUT  ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for     ## more details.                                                                ##                                                                              ## You should have received a copy of the GNU General Public License along      ## with this program; if not, write to the Free Software Foundation, Inc.,      ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                        ##                                                                              ################################################################################## variables that don't really need to be changedMODULENAME="lnsk"DEFAULT_COLOR="\e[0m"WHITE_COLOR="\e[37m\e[1m"ERROR_COLOR="\e[31m\e[1m"SUCCESS_COLOR="\e[32m\e[1m"MESSAGE_COLOR="\e[36m\e[1m"WARNING_COLOR="\e[33m\e[1m"# default user-configurable options in case they don't specifyECHO=echoSED=sedGREP=grepMESSAGES=yes# default location of the config file and modules directoryCONFIG_FILE="/etc/lnsk.conf"MODULES_DIR="/usr/local/lib/lnsk/modules"# get the config file from the command lineif [[ $1 == "-c" ]]; then	CONFIG_FILE=$2	shift 2fi# make sure config file and modules directory locations are in absolute form[ "$($ECHO $CONFIG_FILE | $GREP "^/")" ] || CONFIG_FILE="$PWD/$CONFIG_FILE"[ "$($ECHO $MODULES_DIR | $GREP "^/")" ] || CONFIG_FILE="$PWD/$MODULES_DIR"# ======= Basic functions for use in all modules =======echoif(){	$ECHO "$2" > $1}error(){	if [ "$2" ]; then		MSG="${WHITE_COLOR}$($GREP -H -n "$1" $CONFIG_FILE)${ERROR_COLOR}: ${2}"	else		MSG="$1"	fi	$ECHO -e "${ERROR_COLOR}${MODULENAME}: Error: ${MSG}${DEFAULT_COLOR}"	return 1}warning(){	$ECHO -e "${WARNING_COLOR}${MODULENAME}: Warning: ${1}${DEFAULT_COLOR}"}success(){	$ECHO -e "${SUCCESS_COLOR}${MODULENAME}: ${1}${DEFAULT_COLOR}"}message(){	[[ $MESSAGES == "yes" ]] && $ECHO -e "${MESSAGE_COLOR}${MODULENAME}: ${1}${DEFAULT_COLOR}"}# ======= End basic functions for use in all modules =======runmodule(){(	SECTION=$($ECHO $MODULENAME | $SED "s/lnsk.//")	if [ -r $MODULENAME ]; then		. $MODULENAME		$@	else		error "Could not read $MODULENAME.  Make sure permissions are set correctly."	fi)}# read the config fileif [ -r $CONFIG_FILE ]; then	. $CONFIG_FILEelse	error "Config file ($CONFIG_FILE) is not readable."	exitficase $1 instart|stop|restart)	cd $MODULES_DIR	for MODULENAME in lnsk.*; do		[ -e $MODULENAME ] && runmodule $1	done;;modules)	cd $MODULES_DIR	for MODULENAME in lnsk.*; do		echo $($ECHO $MODULENAME | $SED "s/lnsk.//")	done;;install)	shift	[ "$@" ] && AVAILABLE="$@" || AVAILABLE="lnsk.*"	for MODULENAME in $AVAILABLE; do		read -p "Install module $($ECHO $MODULENAME | $SED "s/lnsk.//")? [y] " INSTALL		if [[ "$INSTALL" == "" ]] || [[ "$INSTALL" == "y" ]] || [[ "$INSTALL" == "yes" ]]; then			cp $MODULENAME $MODULES_DIR		fi	done;;*)	cd $MODULES_DIR	if [ -f lnsk.$1 ]; then		MODULENAME="lnsk.$1"		shift		runmodule $@	else		error "Usage: $0 {start|stop|restart}|{<module> <function> [params]}"	fi;;esac

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -