3
# T H E P I N E M A I L S Y S T E M
5
# Laurence Lundblade and Mike Seibel
6
# Networks and Distributed Computing
7
# Computing and Communications
8
# University of Washington
9
# Administration Building, AG-44
10
# Seattle, Washington, 98195, USA
11
# Internet: lgl@CAC.Washington.EDU
12
# mikes@CAC.Washington.EDU
14
# Please address all bugs and comments to "pine-bugs@cac.washington.edu"
16
# Copyright 1991, 1992 University of Washington
18
# Permission to use, copy, modify, and distribute this software and its
19
# documentation for any purpose and without fee is hereby granted, provided
20
# that the above copyright notice appears in all copies and that both the
21
# above copyright notice and this permission notice appear in supporting
22
# documentation, and that the name of the University of Washington not be
23
# used in advertising or publicity pertaining to distribution of the software
24
# without specific, written prior permission. This software is made
25
# available "as is", and
26
# THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
27
# WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
28
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
29
# NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
30
# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
31
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
32
# (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
33
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
36
# Pine is in part based on The Elm Mail System:
37
# ***********************************************************************
38
# * The Elm Mail System - $Revision: 2.13 $ $State: Exp $ *
40
# * Copyright (c) 1986, 1987 Dave Taylor *
41
# * Copyright (c) 1988, 1989 USENET Community Trust *
42
# ***********************************************************************
48
# mailtrfc.sh -- A shell script to analyze the mail traffic as logged in
49
# /usr/spool/mqueue/syslog*. This currently as the University of Washington
50
# domains wired in and needs to be made more general. Also, lots more
51
# formats of message ID's could be added.
56
org=`awk '/^domain/ {print $2}' < /etc/resolv.conf`
57
domain=`echo $org | sed -e 's/^[^.]*\.//'`
58
host=`hostname`".$org"
60
echo "Domain: $domain"
61
echo "Organization: $org"
62
echo "Hostname: $host"
64
sed -n -e '/message-id/s/^.*</</p' |
65
awk 'BEGIN {mailers[0] = "Other";
67
mailers[2] = "MailManager";
68
mailers[3] = "sendmail";
69
mailers[4] = "BITNET";
70
mailers[5] = "? news ?";
71
mailers[6] = "Sprint";
73
mailers[8] = "Mac MS";
75
mailers[10] = "Andrew";
76
mailers[11] = "Columbia MM";
77
mailers[12] = "Unknown #1";
78
mailers[13] = "EasyMail";
79
mailers[14] = "CompuServe";
80
mailers[15] = "smail";
81
mailers[16] = "MCI Mail";
82
mailers[17] = "VAX MAIL(?)";
83
mailers[18] = "Gator Mail (?)";
84
mailers[19] = "TOTAL";
87
/^<Pine/ {mailer = 1;}
88
/^<MailManager/ {mailer = 2;}
89
/^<[12]?[90]?9[0-9]1?[0-9][1-3]?[0-9]+\.[AaBb][AaBb][0-9]+@/ {mailer = 3;}
90
/^<[0-9A-Z]+@/ {mailer = 4;}
91
/^<199[0-9][A-Za-z]..[0-9]*\./ {mailer = 5;}
92
/@sprint.com/ {mailer = 6;}
93
/\/[A-Z]*=.*\/[A-Z]*=.*/ {mailer = 7;}
94
/^<MacMS\.[0-9]+\.[0-9]+\.[a-z]+@/ {mailer = 8;}
95
/^<MAILQUEUE-[0-9]+\.[0-9]+/ {mailer = 9;}
96
/^<.[d-l][A-Z0-9a-z=_]+00[A-Za-z0-9_=]+@/ {mailer = 10;}
97
/^<CMM\.[0-9]+\.[0-9]+\.[0-9]+/ {mailer = 11 ;}
98
/^<9[0-9][JFMASOND][aepuco][nbrylgptvc][0-9][0-9]?\.[0-9]+[a-z]+\./ {mailer = 12;}
99
/^<EasyMail\.[0-9]+/ {mailer = 13;}
100
/@CompuServe.COM/ {mailer = 14;}
101
/^<m[A-Za-z0-9].....-[0-9A-Za-z].....C@/ {mailer = 15;}
102
/@mcimail.com/ {mailer = 16;}
103
/^<9[0-9][01][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-5][0-9].[0-9a-z]*@/ {mailer = 17;}
104
/^<0[0-9][0-9]+\.[0-9][0-9][0-9][0-9]+\.[0-9][0-9]+@/ {mailer=18;}
108
'"/$domain>/"' {campus[mailer]++; campus[max]++}
109
'"/$org>/"' {u[mailer]++; u[max]++}
110
'"/$host>/"' {milton[mailer]++; milton[max]++}
111
{total[mailer]++; total[max]++}
112
{if(mailer == 0) printf("-->%s\n",$0)}
114
for(m = 0; m <= max; m++) {
115
printf("%-10.10s", mailers[m]);
116
printf(" %11d %11d %11d %11d %11d (%3d%%)\n", milton[m], u[m] - milton[m], campus[m] -u[m], total[m] - campus[m], total[m], (total[m]*100)/total[max]);
118
printf(" ---- (%3d%%) (%3d%%) (%3d%%) (%3d%%)\n", (milton[max]*100)/total[max], ((u[max] - milton[max])*100)/total[max], ((campus[max] - u[max])*100)/total[max], ((total[max] - campus[max])*100)/total[max], (u[max]*100)/total[max]);
123
echo $host $org $domain | \
124
awk '{printf(" %.17s %.11s %.11s Off Campus Total\n", $1, $2, $3)}'
125
egrep -v 'TOTAL|----|^-->' /tmp/syslogx.$$ | sort +0.60rn
126
egrep 'TOTAL|----' /tmp/syslogx.$$
127
grep '^-->' /tmp/syslogx.$$ | sed -e 's/-->//' > other-traffic
128
rm -f /tmp/syslogx.$$