diff options
-rw-r--r-- | lib/custodian/protocoltest/tcp.rb | 7 | ||||
-rwxr-xr-x | t/test-custodian-testfactory.rb | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb index 684452b..c50c144 100644 --- a/lib/custodian/protocoltest/tcp.rb +++ b/lib/custodian/protocoltest/tcp.rb @@ -68,10 +68,13 @@ module Custodian # # Save the port # + @port = nil + if line =~ /on\s+([0-9]+)/ @port = $1.dup - else - @port = nil + end + if line =~ /on\s+port\s+([0-9]+)/ + @port = $1.dup end # diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb index 63cf6c1..f864544 100755 --- a/t/test-custodian-testfactory.rb +++ b/t/test-custodian-testfactory.rb @@ -98,6 +98,8 @@ class TestTestFactory < Test::Unit::TestCase "foo must run rEDIs otherwise 'alert'" => '6379', "foo must run rdp otherwise 'alert'" => '3389', "foo must run RDP otherwise 'alert'" => '3389', + "foo must run tcp on 22 otherwise 'alert'" => '22', + "foo must run tcp on port 22 otherwise 'alert'" => '22', "foo must run mysql on 33 otherwise 'alert'" => '33', } |