diff src/pkg-examine.pl @ 28:dd480255bd82

completed basic draft of pkg-examine script.
author Robert McIntyre <rlm@mit.edu>
date Thu, 10 Jan 2013 16:28:18 +0000
parents d956ace7380e
children 819e950ac8cc
line wrap: on
line diff
     1.1 --- a/src/pkg-examine.pl	Thu Jan 10 15:21:57 2013 +0000
     1.2 +++ b/src/pkg-examine.pl	Thu Jan 10 16:28:18 2013 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  #!/usr/bin/perl
     1.5 -
     1.6 +use File::stat;
     1.7  
     1.8  if ($ARGV[0] eq "--help"){
     1.9    print <<"HERE";
    1.10 @@ -13,8 +13,6 @@
    1.11  exit 0;
    1.12  }
    1.13  
    1.14 -
    1.15 -
    1.16  $" = " ";
    1.17  $pkg_name = $ARGV[0];
    1.18  
    1.19 @@ -25,4 +23,21 @@
    1.20  
    1.21  @files = split(/\0/, `find /usr /opt /etc -group $pkg_name -print0`);
    1.22  
    1.23 -print "@files\n";
    1.24 +
    1.25 +print "All files owned by this package:\n";
    1.26 +foreach (@files){print "   $_\n";}
    1.27 +
    1.28 +print "SetUID/SetGID files:\n";
    1.29 +foreach $file(@files){
    1.30 +
    1.31 +    $sb = stat($file);
    1.32 +    $mode = $sb->mode & 07777;
    1.33 +    if ($mode & 07000){
    1.34 +	printf "%s, %04o\n", $file, $mode;
    1.35 +    }
    1.36 +}
    1.37 +
    1.38 +    
    1.39 +
    1.40 +
    1.41 +