This is a discussion on bash script for iptables within the Linux Security forums, part of the System Security and Security Related category; !/bin/bash # 10 JUN 2004 # Must be run as root grep "localhost kernel" /var/log/syslog|grep PROTO|...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
!/bin/bash
# 10 JUN 2004 # Must be run as root grep "localhost kernel" /var/log/syslog|grep PROTO|while read a1 a2 a3 a4 a5 \ a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 do if test $a16 = "PROTO=UDP" then echo $a1 $a2 $a3 "-0700" $a9 $a10 $a16 $a17 $a18 else echo $a1 $a2 $a3 "-0700" $a9 $a10 $a17 $a18 $a19 fi done -- Felix Tilley Rank: MAJ Fanatic Lartvocate FL# 555-LART |
|
|||
|
Felix Tilley <ftilley@localhost.localdomain> wrote:
> !/bin/bash > # 10 JUN 2004 > > # Must be run as root > > grep "localhost kernel" /var/log/syslog|grep PROTO|while read a1 a2 a3 > a4 a5 \ a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 > > do > if test $a16 = "PROTO=UDP" > then echo $a1 $a2 $a3 "-0700" $a9 $a10 $a16 $a17 $a18 > else echo $a1 $a2 $a3 "-0700" $a9 $a10 $a17 $a18 $a19 > fi > done More sensible way of doing this kind of thing is grep ... | sed ... | while read line; do ( declare $line # 'line' only has VAR=VALUE or VAR strings if [ $PROTO = UDP ]; then echo ... else echo ... fi ) done -- William Park, Open Geometry Consulting, <opengeometry@yahoo.ca> Toronto, Ontario, Canada |
![]() |
| Thread Tools | |
| Display Modes | |
|
|