From 3bbfd2bcb866bdb42dc007447f9d07a6c764dbca Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 29 Jul 2015 12:16:55 +0300 Subject: Added handler for running RDP-tests. This just does a TCP-connection to port 3389. --- lib/custodian/protocoltest/rdp.rb | 90 +++++++++++++++++++++++++++++++++++++++ lib/custodian/protocoltests.rb | 1 + 2 files changed, 91 insertions(+) create mode 100644 lib/custodian/protocoltest/rdp.rb diff --git a/lib/custodian/protocoltest/rdp.rb b/lib/custodian/protocoltest/rdp.rb new file mode 100644 index 0000000..535d950 --- /dev/null +++ b/lib/custodian/protocoltest/rdp.rb @@ -0,0 +1,90 @@ +require 'custodian/protocoltest/tcp' + +# +# The RDP-protocol test. +# +# This object is instantiated if the parser sees a line such as: +# +### +### foo.vm.bytemark.co.uk must run rdp otherwise 'remote desktop fail'. +### +# +# The specification of the port is optional and defaults to 3389 +# +module Custodian + + module ProtocolTest + + class RDPTest < TCPTest + + + # + # Constructor + # + def initialize(line) + + # + # Save the line + # + @line = line + + # + # Save the host + # + @host = line.split(/\s+/)[0] + + # + # Save the port + # + if line =~ /on\s+([0-9]+)/ + @port = $1.dup + else + @port = 3389 + end + end + + + + + # + # Allow this test to be serialized. + # + def to_s + @line + end + + + + + # + # Run the test. + # + def run_test + + # reset the error, in case we were previously executed. + @error = nil + + run_test_internal(@host, @port, nil, false) + end + + + + + # + # If the test fails then report the error. + # + def error + @error + end + + + + + register_test_type 'rdp' + + + + + end + end +end diff --git a/lib/custodian/protocoltests.rb b/lib/custodian/protocoltests.rb index 7e451dd..56fee83 100644 --- a/lib/custodian/protocoltests.rb +++ b/lib/custodian/protocoltests.rb @@ -23,6 +23,7 @@ require 'custodian/protocoltest/mysql' require 'custodian/protocoltest/ping' require 'custodian/protocoltest/pop3' require 'custodian/protocoltest/postgresql' +require 'custodian/protocoltest/rdp' require 'custodian/protocoltest/redis' require 'custodian/protocoltest/rsync' require 'custodian/protocoltest/openproxy' -- cgit v1.2.1