diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/custodian/protocoltest/ftp.rb | 30 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/jabber.rb | 27 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/ldap.rb | 29 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/ping.rb | 24 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/rsync.rb | 30 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/smtp.rb | 29 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/ssh.rb | 31 | ||||
| -rw-r--r-- | lib/custodian/protocoltest/tcp.rb | 18 | ||||
| -rw-r--r-- | lib/custodian/testfactory.rb | 7 | 
9 files changed, 91 insertions, 134 deletions
| diff --git a/lib/custodian/protocoltest/ftp.rb b/lib/custodian/protocoltest/ftp.rb index a816bfd..25271c6 100644 --- a/lib/custodian/protocoltest/ftp.rb +++ b/lib/custodian/protocoltest/ftp.rb @@ -19,27 +19,6 @@ module Custodian        # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - - - - - -      #        # Constructor        #        def initialize( line ) @@ -58,6 +37,15 @@ module Custodian          end          # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end + +        #          # Save the port          #          if ( line =~ /on\s+([0-9]+)/ ) diff --git a/lib/custodian/protocoltest/jabber.rb b/lib/custodian/protocoltest/jabber.rb index 9c0eb6d..1e95650 100644 --- a/lib/custodian/protocoltest/jabber.rb +++ b/lib/custodian/protocoltest/jabber.rb @@ -18,24 +18,6 @@ module Custodian      class JABBERTest < TCPTest -      # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - -        #        # Constructor @@ -53,6 +35,15 @@ module Custodian          @host  = line.split( /\s+/)[0]          # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end + +        #          # Save the port          #          if ( line =~ /on\s+([0-9]+)/ ) diff --git a/lib/custodian/protocoltest/ldap.rb b/lib/custodian/protocoltest/ldap.rb index b27e5d6..ab703e5 100644 --- a/lib/custodian/protocoltest/ldap.rb +++ b/lib/custodian/protocoltest/ldap.rb @@ -20,26 +20,6 @@ module Custodian        # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - - - - -      #        # Constructor        #        def initialize( line ) @@ -55,6 +35,15 @@ module Custodian          @host  = line.split( /\s+/)[0]          # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end + +        #          # Save the port          #          if ( line =~ /on\s+([0-9]+)/ ) diff --git a/lib/custodian/protocoltest/ping.rb b/lib/custodian/protocoltest/ping.rb index c13c17c..95b387c 100644 --- a/lib/custodian/protocoltest/ping.rb +++ b/lib/custodian/protocoltest/ping.rb @@ -19,20 +19,6 @@ module Custodian        # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - - - -      #        # Constructor        #        def initialize( line ) @@ -46,6 +32,16 @@ module Custodian          # Save the host          #          @host  = line.split( /\s+/)[0] + +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end +        end diff --git a/lib/custodian/protocoltest/rsync.rb b/lib/custodian/protocoltest/rsync.rb index 293f67c..3d38d3a 100644 --- a/lib/custodian/protocoltest/rsync.rb +++ b/lib/custodian/protocoltest/rsync.rb @@ -18,25 +18,6 @@ module Custodian      class RSYNCTest < TCPTest -      # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - - -        #        # Constructor @@ -49,13 +30,22 @@ module Custodian          @line = line          # -        # Save the host +        # If the target is an URL then strip to the hostname.          #          @host  = line.split( /\s+/)[0]          if ( @host =~ /^rsync:\/\/([^\/]+)\/?/ )            @host = $1.dup          end +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end +          #          # Save the port diff --git a/lib/custodian/protocoltest/smtp.rb b/lib/custodian/protocoltest/smtp.rb index 0d22c95..89e2b24 100644 --- a/lib/custodian/protocoltest/smtp.rb +++ b/lib/custodian/protocoltest/smtp.rb @@ -20,26 +20,6 @@ module Custodian        # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - - - - -      #        # Constructor        #        def initialize( line ) @@ -55,6 +35,15 @@ module Custodian          @host  = line.split( /\s+/)[0]          # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end + +        #          # Save the port          #          if ( line =~ /on\s+([0-9]+)/ ) diff --git a/lib/custodian/protocoltest/ssh.rb b/lib/custodian/protocoltest/ssh.rb index 205099e..0d64911 100644 --- a/lib/custodian/protocoltest/ssh.rb +++ b/lib/custodian/protocoltest/ssh.rb @@ -17,26 +17,6 @@ module Custodian      class SSHTest < TCPTest - -      # -      # The line from which we were constructed. -      # -      attr_reader :line - - -      # -      # The host to test against. -      # -      attr_reader :host - - -      # -      # The port to connect to. -      # -      attr_reader :port - - -        #        # Constructor        # @@ -54,6 +34,17 @@ module Custodian          #          @host  = line.split( /\s+/)[0] + +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end + +          #          # Save the port          # diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb index c14f686..1aa9db4 100644 --- a/lib/custodian/protocoltest/tcp.rb +++ b/lib/custodian/protocoltest/tcp.rb @@ -23,7 +23,7 @@ module Custodian        # -      # The input line +      # The input line from which we were constructed.        #        attr_reader :line @@ -41,6 +41,12 @@ module Custodian        # +      # Is this test inverted? +      # +      attr_reader :inverted + + +      #        #  The banner to look for, may be nil.        #        attr_reader :banner @@ -65,6 +71,16 @@ module Custodian          #          @host  = line.split( /\s+/)[0] + +        # +        # Is this test inverted? +        # +        if ( line =~ /must\s+not\s+run\s+/ ) +          @inverted = true +        else +          @inverted = false +        end +          #          # Save the port          # diff --git a/lib/custodian/testfactory.rb b/lib/custodian/testfactory.rb index 934d6a7..6ae74d1 100644 --- a/lib/custodian/testfactory.rb +++ b/lib/custodian/testfactory.rb @@ -79,6 +79,13 @@ module Custodian +    # +    #  Is this test inverted? +    # +    def inverted +      @inverted +    end +      #      #  Return the port of this test. | 
