summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2015-07-29 12:16:55 +0300
committerSteve Kemp <steve@steve.org.uk>2015-07-29 12:16:55 +0300
commit3bbfd2bcb866bdb42dc007447f9d07a6c764dbca (patch)
treea08c1eeef5ab6b17c891fcbb141347eb39b6fd5a
parent66564fcfa6e586184c24be6d1ec286564d29d12e (diff)
Added handler for running RDP-tests.
This just does a TCP-connection to port 3389.
-rw-r--r--lib/custodian/protocoltest/rdp.rb90
-rw-r--r--lib/custodian/protocoltests.rb1
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'