Blog O' Matty


Managing PF logfiles with Hatchet!

This article was posted by Matty on 2005-10-08 00:08:00 -0400 -0400

I came across Hatchet while reading through my daily news. Hatchet is a program to summarize PF logfiles, and it looks like an extremely useful piece of software!!

Summarizing mbox formatted mailboxes on Solaris

This article was posted by Matty on 2005-10-08 00:07:00 -0400 -0400

The Solaris mailx(1) utility is a great command line tool for viewing mail, responding to messages, and summarizing mbox formatted mailboxes. I use the following mailx options to periodically summarize my SPAM folder, which is in mbox format:

$ mailx -H -f /export/home/matty/mail/Spam

O 1 Graham Baxter Sat Feb 26 12:50 124/4709 its your last chance!
O 2 Nina Howard Sat Feb 26 12:50 118/4390 its your last chance!
O 3 olita kane Sat Feb 26 13:00 118/5196 Generic Wlaggra

I periodically process the output of this command to see if legitimate mail was tagged as SPAM. Works well!

OpenBSD Security technologies

This article was posted by Matty on 2005-10-08 00:02:00 -0400 -0400

I came across an awesome presentation that describes all of the the security enhancements that been added to OpenBSD to thwart stack- and heap-based overflows. Now that OpenBSD 3.8 is in beta, I cannot wait to download and install 3.8 when it’s released!!

Resolving hostnames with Perl

This article was posted by Matty on 2005-10-07 14:43:00 -0400 -0400

I recently added name resolution support to ldap-stats.pl. This was super easy to do, and only required three lines of Perl code:

### Import the required modules
use Socket;

### Convert the IP address string to an Internet address
my $ipaddr = inet_aton($index);

### Resolve the IP address to a hostname
my $host = gethostbyaddr($ipaddr, AF_INET);

Once the conversion and resolution complete, the name will be available in the $host scalar variable. Giddie up!

Printing ranges with Perl

This article was posted by Matty on 2005-10-07 14:29:00 -0400 -0400

When developing Perl scripts, it is often useful to process a range of characters or numbers. This is easily accomplished with Perl’s “..” range operator:

$ perl -e 'foreach (1 .. 10 ) { print "_ "; }'

1
2
3
4
5
6
7
8
9
10

Perl seems to contain just about everything, and is definitely the Cadillac of programming lanaguages.