Here is a way to monitor iptables in realtime without needing an external program(s) or module(s). This is done using Perl and parsing the output from the iptables list utility.

A note from the original author:

To be effective, the xterm window needs to be at least as high as the output, else scrolling will ruin the visual effect. Also, the code may be iptables version-dependent, as it matches certain keywords for the formatting. Once started, it can be stopped with a ctl-C, which will restore some of the display settings

I had the desire to have a menu created from an array which I passed to a sub routine. So I searched around and found a nice one on perlmonks.org but it was based on array refs and creating a multi-dimensional array. This was way overkill for what I wanted and needed. Here is the link to that script as it is still a very nice script.Simple Text menu
Here is a link to another script I found on there that was pretty good for a more permanent menu system.Building a Perl Menu

How to create a simple menu using a Perl sub-routine.

sub menu
{
# The array passed to this sub-routine must be passed
# as a Array Reference.
my $tmpRefArray = shift;
# Convert the Array Reference back to an array
my @m = @{$tmpRefArray};
# If you want to insert a static title you can do it here.
#unshift @m, 'Insert menu title here';
# Remove all newlines throughout the entire array.
chomp(@m);
my $choice;
while (1)
{
# Comment out this line if you don't want a title.
# Otherwise the first element in the array must be the title.
print "$m[0]\n";
print map { "\t$_. $m[$_]\n" } (1..$#m);
print "Choose (1-$#m)> ";
chomp ($choice = <STDIN>);
last if ( ($choice > 0) && ($choice <= $#m ));
print "You chose '$choice'. That is not a valid option.\n\n";
}
return "$m[$choice]\n";
}

# A quick way to build an array for something important.
my @procsvcwrappers = `find /etc/init.d/*`;
# Insert a title as the first element in the Array (aka $procsvcwrappers[0])
unshift @procsvcwrappers, 'Choose a Process Service Wrapper:';
# Pass the array as an Array Reference
# and
# Save the value returned to $procsvcwrapper.
my $procsvcwrapper = menu(\@procsvcwrappers);
print "You selected Process Service Wrapper \"$procsvcwrapper\".\n";

March 24, 2011

I have run into a problem over the years where my linux system(s) is not on a network accessible segment but rather in a completely firewalled (i.e. POC) DMZ and only available via sneaker net.

This poses issues when I need to upgrade the OS (i.e. CentOS 5.2 to CentOS 5.4) and make sure the same versions of 3rd party software gets reinstalled on the newer version of OS. To try and solve the 3rd party software issue I have kept pretty detailed logs (software versions on which systems) of what is installed but every now and again I forget to update my list of installed 3rd party software. So I use the following steps to figure out what software must be reinstalled.

The first step I have done is check to see what RPMs are installed and in the RPM database. This is nice to have but it doesn’t tell me the complete rpm that was used for the install.

rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}

The second step I compare the output from the RPM database against the log (/var/log/rpmpkgs*) that gets written to when each RPM gets installed. This can be a very long process especially if you have done upgrades to your system recently. I normally do this with a quick shell script. I decided it would be best to attack it with a Perl script since I am more fond of Perl scripting then shell scripting.

At some point in time the RPM Packages log gets updated. I haven’t managed to track down the timing for exactly when it gets updated. If anyone knows this please let me know.

means I18N. If there is a translation available for that string, it is used instead of the given text. If not, or if the locale is C/POSIX, the dollar sign simply is ignored, which results in a normal double-quoted string.

If the string was replaced (translated), the result is double-quoted.

In case you’re a C-programmer: The purpose of $"..." is the same as for gettext() or _().