#
# This is the IRIX initialization file for securscan.
#
# It gathers all IRIX-specific information needed to run the
# scanner.
#

$md5 = "$api{'whereami'}/bin/md5";

## Look thought the versions output and catch all systems
open(VERSIONS, "/usr/sbin/versions |");
while (<VERSIONS>) {
  @tmp = split(/\s+/, $_);
  if ($tmp[0] eq 'I') {
    $versions{$tmp[1]} = 1;
    }
  }
close(VERSIONS);

## Look though chkconfig to get all the config options
open(CHKCONFIG, "/etc/chkconfig |");
while (<CHKCONFIG>) {
  @tmp = split(/\s+/, $_);
  if ($tmp[2] eq 'on') {
    $chkconfig{$tmp[1]} = 1;
    }
  }
close(CHKCONFIG);

## returns the md5 checksum for a file
sub getmd5 {
  local($file) = shift;
  chop($_ = `$md5 $file`);
  (split(' = ', $_))[1];
  }

## We should always exit successfully
1;
