3
3
# description: Firewall-log filter script (fwfilter)
4
# Last update: February 22, 2006
4
# Last update: May 2, 2006
6
6
# Usage examples (make sure arno-fwfilter is executable!):
7
# ---------------------------------------------------
7
# --------------------------------------------------------
8
8
# Static firewall log filtering : cat /var/log/messages |arno-fwfilter
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"
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;;
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
87
*) echo "Internal error!"; exit 1;;
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;;
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
87
*) echo "Internal error!"; exit 1;;
91
91
if [ -z "$AWK_BIN" ]; then
516
516
if (USE_HTML==1) printf("</font>")
519
520
for (i = save_offset; i <= NF; i++)
520
521
# Show all other info
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=")
523
if (substr($i,1,1) == "[") ICMP_INFO=1
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")
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=")
528
540
if (USE_HTML==1) printf("<br>")