~ubuntu-branches/ubuntu/jaunty/arno-iptables-firewall/jaunty

« back to all changes in this revision

Viewing changes to arno-fwfilter

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2006-10-30 08:18:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061030081855-xwbqq0v9ussymjk7
Tags: 1.8.8.c-1
New upstream release (fixed MAC-filter).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
2
#
3
3
# description: Firewall-log filter script (fwfilter)
4
 
# Last update: February 22, 2006
 
4
# Last update: May 2, 2006
5
5
 
6
6
# Usage examples (make sure arno-fwfilter is executable!):
7
 
# ---------------------------------------------------
 
7
# --------------------------------------------------------
8
8
# Static firewall log filtering                         : cat /var/log/messages |arno-fwfilter
9
9
# or
10
10
# Static firewall log filtering                         : cat /var/log/firewall |arno-fwfilter
67
67
# Note the quotes around `$CLOPTS': they are essential!
68
68
eval set -- "$CLOPTS"
69
69
 
70
 
while true ; do
71
 
        case "$1" in
72
 
                -r|--no-resolve) RESOLVE_NAMES=0; shift;;
73
 
                -o|--html-output) USE_HTML=1; shift;;
74
 
                -l|--no-locations) SHOW_LOCATION=0; shift;;
75
 
                -c|--no-colors) USE_ANSI_COLORS=0; shift;;
76
 
                -s|--single-line) USE_1ROW=1; shift;;
77
 
                -h|--help)
78
 
                echo "Options:"
79
 
                echo "-h, --help         - Print this help"
80
 
                echo "-o, --html-output  - Use basic HTML to format the output"
81
 
                echo "-l, --no-locations - Disable obtaining the IP's geographical location"
82
 
                echo "-c, --no-colors    - Disable the use of (ANSI) colors in the output."
83
 
                echo "-s, --single-line  - Put all information about an event in a single line"
84
 
                exit 0 # nothing left to do
85
 
                ;;
86
 
                --) shift ; break ;;
87
 
                *) echo "Internal error!"; exit 1;;
88
 
        esac
 
70
while true; do
 
71
  case "$1" in
 
72
    -r|--no-resolve) RESOLVE_NAMES=0; shift;;
 
73
    -o|--html-output) USE_HTML=1; shift;;
 
74
    -l|--no-locations) SHOW_LOCATION=0; shift;;
 
75
    -c|--no-colors) USE_ANSI_COLORS=0; shift;;
 
76
    -s|--single-line) USE_1ROW=1; shift;;
 
77
    -h|--help)
 
78
    echo "Options:"
 
79
    echo "-h, --help         - Print this help"
 
80
    echo "-o, --html-output  - Use basic HTML to format the output"
 
81
    echo "-l, --no-locations - Disable obtaining the IP's geographical location"
 
82
    echo "-c, --no-colors    - Disable the use of (ANSI) colors in the output."
 
83
    echo "-s, --single-line  - Put all information about an event in a single line"
 
84
    exit 0 # nothing left to do
 
85
    ;;
 
86
    --) shift ; break ;;
 
87
    *) echo "Internal error!"; exit 1;;
 
88
  esac
89
89
done
90
90
 
91
91
if [ -z "$AWK_BIN" ]; then
516
516
          if (USE_HTML==1) printf("</font>")
517
517
        }
518
518
 
 
519
        ICMP_INFO=0
519
520
        for (i = save_offset; i <= NF; i++)
520
521
        # Show all other info
521
522
        {
522
 
          if (substr($i,1,6) != "PROTO=" && substr($i,1,5) != "PREC=" && substr($i,1,4) != "TOS=" && substr($i,1,3) != "ID=" \
523
 
           && substr($i,1,4) != "LEN=" && i != 4 && i != 5 && substr($i,1,2) != "DF" && substr($i,1,4) != "SPT=" && substr($i,1,4) != "DPT=" \
524
 
           && $i != "RES=0x00" && $i != "URGP=0" && substr($i,1,7) != "WINDOW=" && substr($i,1,5) != "TYPE=" && substr($i,1,5) != "CODE=")
525
 
             printf("%s ", $i)
 
523
          if (substr($i,1,1) == "[") ICMP_INFO=1
 
524
          if (ICMP_INFO==1)
 
525
          {
 
526
            if (substr($i,1,5) != "PREC=" && substr($i,1,4) != "TOS=" && substr($i,1,3) != "ID=" \
 
527
              && i != 4 && i != 5 && substr($i,1,2) != "DF" \
 
528
              && $i != "RES=0x00" && $i != "URGP=0")
 
529
                printf("%s ", $i)
 
530
          }
 
531
          else
 
532
          {
 
533
            if (substr($i,1,6) != "PROTO=" && substr($i,1,5) != "PREC=" && substr($i,1,4) != "TOS=" && substr($i,1,3) != "ID=" \
 
534
              && substr($i,1,4) != "LEN=" && i != 4 && i != 5 && substr($i,1,2) != "DF" && substr($i,1,4) != "SPT=" && substr($i,1,4) != "DPT=" \
 
535
              && $i != "RES=0x00" && $i != "URGP=0" && substr($i,1,7) != "WINDOW=" && substr($i,1,5) != "TYPE=" && substr($i,1,5) != "CODE=")
 
536
                printf("%s ", $i)
 
537
          }
526
538
        }
527
539
      }
528
540
      if (USE_HTML==1) printf("<br>")