diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-07-29 12:16:55 +0300 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-07-29 12:16:55 +0300 |
commit | 3bbfd2bcb866bdb42dc007447f9d07a6c764dbca (patch) | |
tree | a08c1eeef5ab6b17c891fcbb141347eb39b6fd5a /lib/custodian/protocoltest | |
parent | 66564fcfa6e586184c24be6d1ec286564d29d12e (diff) |
Added handler for running RDP-tests.
This just does a TCP-connection to port 3389.
Diffstat (limited to 'lib/custodian/protocoltest')
-rw-r--r-- | lib/custodian/protocoltest/rdp.rb | 90 |
1 files changed, 90 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 |