md5sum check
w3b
created: 2006-03-23 00:57:00
#!/usr/bin/perl
use warnings;
use strict;

if(-e '.sumlog'){
        open (FILE, '.sumlog');
        my @records =;

        foreach my $record(@records){
                chomp($record);
                my @arty = split('::',$record);

                open(MD5, "md5sum $arty[1] |");
                my $wyn = ;

                my @act = split('  ',$wyn);

                if ($act[0] eq $arty[0]){
                        print $arty[1]."... ok \n";
                } else {
                        print $arty[1]."... not ok \n";

                }
        }
} else {
        open (FILE, '>>.sumlog');
        open (COMM, "md5sum /etc/ssh/sshd_config |");

        my @comm = split(' ', );
        print FILE $comm[0].'::'.$comm[1];

        print "Write checksum::patch to file in .sumlog\n";
}
Re: md5sum check
created: 2006-03-23 05:35:34
This is all well and fine, but if someone has the savy to be able to alter your /etc/passwd file, they're likely not going to be tripped up by editing this thing as well. As for me, I like Tripwire. It's free for non-commercial use and does a very robust job of integrity checking.

thor

The only easy day was yesterday

Re: md5sum check
created: 2006-03-23 10:38:11
An alternative to the md5sum pipe is to use [cpan://Digest::MD5] and keep it all perl:
use Digest::MD5;
foreach my $record(@records){
  chomp($record);
  my @arty = split('::',$record);
  open MD5, '<', $arty[1];
  binmode MD5;
  my $act = Digest::MD5->new->addfile(*MD5)->hexdigest;
  printf "%s... %s \n", $arty[1], ($act eq $arty[0] ? "ok" : "not ok");
  close MD5;
}
Re: md5sum check
created: 2006-03-23 11:36:20
In case you're interested in a more comprehensive integrity checking tool written in perl, have a look to afick (another file integrity checker).
Re^2: md5sum check
w3b
created: 2006-03-23 15:51:52
Thx for link i will visit this site =] maybe later i will write somethink interesting;P

perlmonks.org content © perlmonks.org and davidrw, thor, w3b, wazoox

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03