Created
January 23, 2013 07:51
-
-
Save bvierra/4602926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $which = '/usr/bin/which'; | |
my $md5sum = '/usr/bin/md5sum'; | |
my $sudo_md5 = 'db4e0aec4ef7639dd14bc4e2cd0591ce /usr/bin/sudo'; | |
my $sudo_path = '/usr/bin/sudo'; | |
my $bash_md5 = '9a99d4a76f3f773f7ab5e9e3e482c213 /bin/bash'; | |
my $bash_path = '/bin/bash'; | |
my ($sudo_md5_status,$sudo_path_status); | |
my ($bash_md5_status,$bash_path_status); | |
my $error; | |
my $check_sudo_path = `$which sudo`; | |
chomp($check_sudo_path); | |
if ($check_sudo_path eq $sudo_path) { | |
$sudo_path_status = "Ok"; | |
} else { | |
$sudo_path_status = "BAD"; | |
$error += "Sudo Path Status Failed\n"; | |
$error += "Expected:\t$sudo_path\n"; | |
$error += "Got:\t\t$check_sudo_path"; | |
} | |
my $check_sudo_md5 = `$md5sum $sudo_path`; | |
chomp($check_sudo_md5); | |
if ($check_sudo_md5 eq $sudo_md5) { | |
$sudo_md5_status = "Ok"; | |
} else { | |
$sudo_md5_status = "BAD"; | |
$error += "Sudo Hash Status Failed\n"; | |
$error += "Expected:\t$sudo_md5\n"; | |
$error += "Got:\t\t$check_sudo_md5"; | |
} | |
my $check_bash_path = `$which bash`; | |
chomp($check_bash_path); | |
if ($check_bash_path eq $bash_path) { | |
$bash_path_status = "Ok"; | |
} else { | |
$bash_path_status = "BAD"; | |
$error += "Bash Path Status Failed\n"; | |
$error += "Expected:\t$bash_path\n"; | |
$error += "Got:\t\t$check_bash_path"; | |
} | |
my $check_bash_md5 = `$md5sum $bash_path`; | |
chomp($check_bash_md5); | |
if ($check_bash_md5 eq $bash_md5) { | |
$bash_md5_status = "Ok"; | |
} else { | |
$bash_md5_status = "BAD"; | |
$error += "Bash Hash Status Failed\n"; | |
$error += "Expected:\t$bash_md5\n"; | |
$error += "Got:\t\t$check_bash_md5"; | |
} | |
print "Program\t\tPath\tChecksum\n"; | |
print "Bash\t\t$bash_path_status\t$bash_md5_status\n"; | |
print "Sudo\t\t$sudo_path_status\t$sudo_md5_status\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment