rlm@25: #!/usr/bin/perl rlm@28: use File::stat; rlm@25: rlm@25: if ($ARGV[0] eq "--help"){ rlm@25: print <<"HERE"; rlm@25: rlm@25: pkg-examine -- print package contents. rlm@25: rlm@25: Written by Robert McIntyre. This software is free rlm@25: software and is released to the public domain. rlm@25: rlm@25: HERE rlm@25: exit 0; rlm@25: } rlm@25: rlm@25: $" = " "; rlm@25: $pkg_name = $ARGV[0]; rlm@25: rlm@25: `id -g $pkg_name 2>/dev/null`; rlm@25: if ($?){ rlm@25: print "No group named $pkg_name."; rlm@25: exit 0;} rlm@25: rlm@25: @files = split(/\0/, `find /usr /opt /etc -group $pkg_name -print0`); rlm@25: rlm@28: rlm@28: print "All files owned by this package:\n"; rlm@28: foreach (@files){print " $_\n";} rlm@28: rlm@28: print "SetUID/SetGID files:\n"; rlm@28: foreach $file(@files){ rlm@28: rlm@28: $sb = stat($file); rlm@28: $mode = $sb->mode & 07777; rlm@28: if ($mode & 07000){ rlm@28: printf "%s, %04o\n", $file, $mode; rlm@28: } rlm@28: } rlm@28: rlm@28: rlm@28: rlm@28: rlm@28: