diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/protocoltest/rdp.rb | 90 | ||||
-rw-r--r-- | lib/custodian/protocoltests.rb | 1 |
2 files changed, 91 insertions, 0 deletions
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' |