"Fossies" - the Fresh Open Source Software Archive

Member "portsentry-2.0b1/ignore.csh" (8 Apr 2002, 2939 Bytes) of package /linux/privat/old/portsentry-2.0b1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/csh -f
    2 #########################################################################
    3 # This script automatically adds hosts to the .ignore file              #
    4 # of PortSentry. This is useful for dynamic IP hosts and                #
    5 # should be run after each reboot or IP change.                         #
    6 #                                                                       #
    7 # Author: Christopher P. Lindsey <lindsey@mallorn.com>                  #
    8 # Date: 06-03-99                                                        #
    9 # Note: Created script                                                  #
   10 #                                                                       #
   11 # Modified: Craig H. Rowland <crowland@psionic.com>                     #
   12 # Modified Date: 06-03-99                                               #
   13 # Modified Note: Fixed /tmp race condition. Added secure path.          #
   14 #                                                                       #
   15 # Modified: Christopher P. Lindsey <lindsey@mallorn.com>                #
   16 # Modified Date: 06-04-99                                               #
   17 # Modified Note: Added support for various OSs, -f flag on startup      #
   18 #                                   #
   19 # Modified: Craig H. Rowland <crowland@psionic.com>                 #
   20 # Modified Date: 04-08-02                                               #
   21 # Modified Note: Changed SENTRYDIR to portsentry2           #
   22 #                                   #   
   23 #                                                                       #
   24 # $Id: ignore.csh,v 1.5 2002/04/08 17:23:58 crowland Exp crowland $     #
   25 #########################################################################
   26 
   27 # Choose an OS
   28 #
   29 # Acceptable values are "FreeBSD", "HPUX", "IRIX", "Linux", "OSF1",
   30 # "NeXTStep", "Solaris 2.x", "SunOS 4.x"
   31 set OS="Linux"
   32 
   33 # Known good path
   34 set path = (/bin /usr/bin /sbin /usr/sbin)
   35 
   36 if ($OS == "IRIX") then
   37    set path = ($path /usr/etc)
   38 elseif ($OS == "NeXTStep" || $OS == "SunOS 4.x") then
   39    set path = ($path /etc)
   40 endif
   41   
   42 # Safe directory 
   43 set SENTRYDIR=/usr/local/psionic/portsentry2
   44 set TMPFILE=portsentry.ignore.tmp
   45  
   46 if (-f $SENTRYDIR/portsentry.ignore) then 
   47    head -3 $SENTRYDIR/portsentry.ignore > $SENTRYDIR/$TMPFILE
   48 else
   49    echo > $SENTRYDIR/$TMPFILE
   50 endif
   51 
   52 # This entry should always be in the file.
   53 echo '0.0.0.0' >> $SENTRYDIR/$TMPFILE
   54 
   55 if ($OS == "Linux") then 
   56    foreach i ( `ifconfig -a | grep inet | awk '{print $2}' | sed 's/addr://'` )
   57       echo $i >> $SENTRYDIR/$TMPFILE
   58    end
   59 else if ($OS == "HPUX") then
   60    foreach i (`lanscan -i`)
   61       ifconfig $i | grep inet | awk '{print $2}' >> $SENTRYDIR/$TMPFILE
   62    end
   63 else if ($OS == "Solaris 2.x" || $OS == "NeXTStep" || $OS == "FreeBSD" || \
   64          $OS == "SunOS 4.x" || $OS == "OSF1" || $OS == "IRIX") then
   65    foreach i ( `ifconfig -a | grep inet | awk '{print $2}'` )
   66       echo $i >> $SENTRYDIR/$TMPFILE
   67    end
   68 endif
   69 
   70 cp $SENTRYDIR/$TMPFILE $SENTRYDIR/portsentry.ignore
   71 rm $SENTRYDIR/$TMPFILE