#!/usr/bin/perl
#
# ypbind-chk.saint
#
# identify operating systems which have
# vulnerable versions of ypbind
#
# Usage: ypbind-chk.saint [OS type] target [FW][.PLUS]
#
# Sam Kline, SAINT Corp., 5/02
#
require 'perl/misc.pl';
require 'config/paths.pl';

print "BEGIN\n";
$argptr = $#ARGV;
if (($ARGV[$argptr] eq "FW") ||
    ($ARGV[$argptr] eq ".PLUS") ||
    ($ARGV[$argptr] eq "FW.PLUS")) { $argptr--; }

$target = $ARGV[$argptr];
$service = "ypbind";
$argptr--;

if ($argptr < 0) {
  $ostype = "UNKNOWN";
} else {
  $ostype = join (" ", @ARGV[0..$argptr]);
}

$status = "a";
$trusted = "ANY@$target";
$trustee = "ANY@$target";

if (($ostype eq "SunOS") ||
    ($ostype eq "SunOS 5") ||
    ($ostype =~ /SunOS 5.[4-8]/) ||
    ($ostype =~ /Solaris 2.[4-8]/) ||
    ($ostype =~ /Solaris [78]/)) {
	$severity = "bo";
	$service_output = "ypbind detected";
	$text = "ypbind may be vulnerable to buffer overflow";
	&saint_print();
} elsif ($ostype eq "UNKNOWN") {
	$severity = "zcio";
	$service_output = "ypbind detected";
	$text = "ypbind may be vulnerable to buffer overflow";
	&saint_print();
}

