Jerry has asked for the wisdom of the Perl Monks concerning the following question:
I'm consulting for a small ISP that uses sendmail. We are being hammered by spammers, so I felt a perl solutions would be more than sufficient. What I'm attempting to do is monitor /var/log/messages for the hoards of "User unknown" messages resulting from name-list spam techniques. The messages log contains the pid of the sendmail process in question. I can then run a ps aux, match up the pid, and get the IP of the spammer, so that I can then add it to my firewall's block list.
This sounds like a fairly simple job for
perl, however I am running into extreme difficulty
splitting the ps aux into a usable format. Proc::ProcessTable is incredibly poorly documented, so
it has been of little aid to this point. Here is a sample
of a line from ps aux that I would need to extract the
IP address from:
root 27979 0.0 0.7 1468 1008 ? S 14:59 0:00 sendmail: s +erver foo.bar.org [222.22.22.21] cmd read
Any suggestions for handling the ps aux and extracting the IP would be greatly appreciated!
-Jerry http://www.digilliance.net
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ps aux and perl
by c (Hermit) on Aug 21, 2001 at 23:15 UTC | |
|
Re: ps aux and perl
by lemming (Priest) on Aug 21, 2001 at 23:19 UTC | |
by bbfu (Curate) on Aug 22, 2001 at 02:03 UTC | |
by Jerry (Scribe) on Aug 22, 2001 at 00:08 UTC | |
|
Re: ps aux and perl
by Cine (Friar) on Aug 21, 2001 at 23:34 UTC | |
by Jerry (Scribe) on Aug 22, 2001 at 00:00 UTC | |
by Cine (Friar) on Aug 22, 2001 at 00:08 UTC | |
by Jerry (Scribe) on Aug 22, 2001 at 00:11 UTC | |
by Cine (Friar) on Aug 22, 2001 at 00:14 UTC | |
|
Re: ps aux and perl
by Beatnik (Parson) on Aug 21, 2001 at 23:31 UTC | |
by Jerry (Scribe) on Aug 21, 2001 at 23:36 UTC |