address_config.sh

来自「该软件是一个有名的基于网络的入侵检测系统」· Shell 代码 · 共 30 行

SH
30
字号
#!/bin/sh
# address_config.sh -v0.2
# Handy script for laptop users that change their
# IP address frequently. This automates the
# process of updating your Snort rules file.
# You might find his litle script can be usefull, enjoy...
# Sten Kalenda Apeldoorn The Netherlands
# ------------------ MODIFY HERE ---------------------------------------
IF0=eth0
MASK="24"
SNORTDIR="/usr/local/bin"
SNORTLIBDIR="$SNORTDIR/snortlib"
SNORTLOGDIR="/var/log/snort"
# ------------------ DO NOT CHANGE BELOW -------------------------------
if [ ! -d "$SNORTLIBDIR" ] ; then
   echo Directory $SNORTLIBDIR not found
   exit
fi
cd $SNORTLIBDIR
if [ ! -e "$SNORTLOGDIR" ] ; then
   mkdir $SNORTLOGDIR
   chmod 700 $SNORTLOGDIR
fi
MYIP=`/sbin/ifconfig $IF0|sed -n -e "s/^[ ]*inet addr\:\([0-9.]*\).*$/\1/p"`
CHG=s\/10\.1\.1\.0\\/24/$MYIP\\/$MASK/g
cat snort-lib | sed $CHG > snort-lib_run

$SNORTDIR/snort -D -A fast -c $SNORTLIBDIR/snort-lib_run

⌨️ 快捷键说明

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