As people might know, i have a mirror of the www.honeynet.org project at www.honeynet.nl. Recently Lance Spitzner and I reviewed some of the mirrors and since it takes a little time I thought it would be good if there is an automated script available.

Currently the script checks what the last modification time of the index file is (of the official server first) and then scans the other mirrors to see their last modification time. They should be the same after about an week (not sure how we can check that though).

And ofcourse since my script is BSD licensed; i attached it below (click on the read more link).

If you have suggestions on how to make the script better. Please let me know. I will also put this script in the download section and make a reference to an text file so that you can use it.


#!/usr/bin/perl -w
###########################################################################
# $Id$
###########################################################################

###########################################################################
# Copyright (C) 2005, Remko Lodder . All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS “AS IS” AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
###########################################################################

###########################################################################
# PART OF: Standalone
# Simple perlscript to see what mirrors are outdated and what their mirrored
# timestamp is.
###########################################################################

use strict;
use warnings;
use LWP::Simple;;

###########################################################################
# variables. All configurable options are defined below. Please adjust them
# to your need.
###########################################################################

my $source      = "http://www.honeynet.org";

my @mirrors     = qw(   http://honeynet.lss.hr
                        http://honeynet.startx.fr
                        http://honeynet.fh.net
                        http://honeynet.spenneberg.org
                        http://honeynet.securityinfos.com
                        http://www.honeynet.nl
                        http://honeynet.pop2internet.com
                        http://honeynet.opensourcecommunity.ph
                        http://honeynet.secuwiz.com
                        http://honeynet.xfocus.net
                        http://mirror.honeynet.org.br
                        http://honeynet.killgizmo.ca
                        http://honeynet.hostingzero.com
                        http://honeynet.5dollarwhitebox.org
                        http://honeynet.streetchemist.com
);

my %mirrors;

my $honeynet_ctime = fetch_data($source);
$honeynet_ctime = scalar localtime($honeynet_ctime);

print "———————– Honeynet Mirror Checkup —————-\n";
print "Official mirror changetime: $honeynet_ctime\n";
print "———————– Honeynet Mirror List —————-\n";
print "Mirrorname\t\tChangetime\n";

foreach my $mirror (@mirrors)
{
        $mirrors{$mirror} = fetch_data($mirror);
        my $localtime = scalar localtime($mirrors{$mirror});
        if ($localtime =~ /$honeynet_ctime/) { print "OK: $mirror\t\tchanged: $localtime\n" }
        else { print "BAD: $mirror\t\tchanged: $localtime\n"; }
}

###########################################################################
# Do not edit anything below this line unless you know what you are doing.
###########################################################################

sub fetch_data
{
  my $source = shift;

  if (my @return = head("$source"))
  {
        return $return[2];
  }
}
r

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>