Debian Codegraph @

contrib/fwlogsummary.cgi

raw
1 #!/bin/sh
2 # Copyright (C) 2000-2013 Boris Wesslowski
3 # $Id: fwlogsummary.cgi 731 2013-05-17 14:15:23Z bw $
4
5 # This script generates 8 fwlogwatch html summaries in a directory visible
6 # to your web server.
7 # The log file to be used can be specified as first parameter, default is
8 # /var/log/messages
9 # With respective permissions it can be run as cgi by the webserver.
10 # You can also invoke this script directly from the command line or from
11 # cron (you might want to remove the header output).
12
13 echo 'Content-type: text/plain'
14 echo
15
16 echo -n 'fwlogsummary invoked '
17 date
18
19 RECENT="-l 1h"
20 WEBDIR="/var/www/html/fwlogwatch"
21 FWLOGWATCH="/usr/local/sbin/fwlogwatch"
22
23 if [ ! -d $WEBDIR ] ; then
24 echo "Directory $WEBDIR does not exist!"
25 exit
26 fi
27
28 if [ ! -f $FWLOGWATCH ] ; then
29 echo "$FWLOGWATCH not found!"
30 exit
31 fi
32
33 if [ -z $1 ]
34 then
35 MESSAGES="/var/log/messages"
36 else
37 MESSAGES="$1"
38 fi
39
40 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -S -o $WEBDIR/dst.html
41 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -D -o $WEBDIR/src.html
42 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -o $WEBDIR/src_dst.html
43 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -s -o $WEBDIR/src_dst_sp.html
44 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -d -o $WEBDIR/src_dst_dp.html
45 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -s -d -o $WEBDIR/src_dst_sp_dp.html
46 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -s -d -y -o $WEBDIR/src_dst_sp_dp_op.html
47 $FWLOGWATCH $MESSAGES $RECENT -w -t -z -s -d -y -n -o $WEBDIR/all.html
48
49
50 cat <<EOF > $WEBDIR/index.html
51 <html>
52 <head>
53 <title>fwlogwatch</title>
54 </head>
55 <body text="#000000" bgcolor="#FFFFFF" >
56 <font face="Arial, Helvetica">
57
58 <div align="center">
59 <h1>fwlogwatch summaries</h1>
60 <a href="/cgi-bin/fwlogsummary.cgi">regenerate summaries now</a>
61 </div>
62
63 <h3>Summary by criteria:</h3>
64 <small>Press the back button of your browser to return here.</small>
65 <ul>
66 <li><a href="src.html">source IP address only</a></li>
67 <li><a href="dst.html">destination IP address only</a></li>
68 <li><a href="src_dst.html">source and destination IP addresses</a></li>
69 <ul>
70 <li><a href="src_dst_sp.html">with source port</a></li>
71 <li><a href="src_dst_dp.html">with destination port</a></li>
72 <li><a href="src_dst_sp_dp.html">with source and destination ports</a></li>
73 <ul>
74 <li><a href="src_dst_sp_dp_op.html">with tcp options</a></li>
75 </ul>
76 </ul>
77 <li><a href="all.html">everything and name resolution</a></li>
78 </ul>
79 <br>
80 <hr>
81 <small><a href="http://fwlogwatch.inside-security.de/">fwlogwatch</a> &copy; Boris Wesslowski</small>
82
83 </font>
84 </body>
85 </html>
86 EOF
87
88 echo -n "Finished "
89 date
90
91 # EOF