Class: Rex::Proto::DCERPC::Handle::UnitTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Rex::Proto::DCERPC::Handle::UnitTest
- Defined in:
- lib/rex/proto/dcerpc/handle.rb.ut.rb
Constant Summary collapse
Instance Method Summary collapse
- #test_invalid ⇒ Object
- #test_ncacn_http ⇒ Object
- #test_ncacn_ip_tcp ⇒ Object
- #test_ncacn_ip_udp ⇒ Object
- #test_ncacn_np ⇒ Object
- #test_parser ⇒ Object
- #test_parser_invalid ⇒ Object
Instance Method Details
#test_invalid ⇒ Object
64 65 66 67 68 69 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 64 def test_invalid assert_raise(Rex::ArgumentError, 'invalid uuid') { Klass.new(['a', '1.0'], 'ncacn_ip_tcp', '1.2.3.4', [80]) } assert_raise(Rex::ArgumentError, 'invalid uuid version') { Klass.new(['6bffnd098-a112-3610-9833-46c3f87e345a', 'b'], 'ncacn_ip_tcp', '1.2.3.4', [80]) } assert_raise(Rex::ArgumentError, 'invalid proto') { Klass.new(['6bffnd098-a112-3610-9833-46c3f87e345a', '1.0'], 'ncacn_ip_bmc', '1.2.3.4', [80]) } assert_raise(Rex::ArgumentError, 'invalid empty uuid') { Klass.new([nil, '1.0'], 'ncacn_ip_tcp', '1.2.3.4', [80]) } end |
#test_ncacn_http ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 51 def test_ncacn_http uuid = ['6bffd098-a112-3610-9833-46c3f87e345a', '1.0'] protocol = 'ncacn_http' host = '1.2.3.4' = [80] i = Klass.new(uuid, protocol, host, ) assert(i, 'new') assert_equal(i.to_s, '6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_http:1.2.3.4[80]', 'as string') assert_equal(uuid, i.uuid, 'uuid') assert_equal(protocol, i.protocol, 'protocol') assert_equal(, i., 'options') end |
#test_ncacn_ip_tcp ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 25 def test_ncacn_ip_tcp uuid = ['6bffd098-a112-3610-9833-46c3f87e345a', '1.0'] protocol = 'ncacn_ip_tcp' host = '1.2.3.4' = [80] i = Klass.new(uuid, protocol, host, ) assert(i, 'new') assert_equal('6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_ip_tcp:1.2.3.4[80]', i.to_s, 'as string') assert_equal(uuid, i.uuid, 'uuid') assert_equal(protocol, i.protocol, 'protocol') assert_equal(, i., 'options') end |
#test_ncacn_ip_udp ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 38 def test_ncacn_ip_udp uuid = ['6bffd098-a112-3610-9833-46c3f87e345a', '1.0'] protocol = 'ncacn_ip_udp' host = '1.2.3.4' = [80] i = Klass.new(uuid, protocol, host, ) assert(i, 'new') assert_equal('6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_ip_udp:1.2.3.4[80]', i.to_s, 'as string') assert_equal(uuid, i.uuid, 'uuid') assert_equal(protocol, i.protocol, 'protocol') assert_equal(, i., 'options') end |
#test_ncacn_np ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 12 def test_ncacn_np uuid = ['6bffd098-a112-3610-9833-46c3f87e345a', '1.0'] protocol = 'ncacn_np' host = '1.2.3.4' = ['\wkssvc'] i = Klass.new(uuid, protocol, host, ) assert(i, 'new') assert_equal('6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_np:1.2.3.4[\wkssvc]', i.to_s, 'as string') assert_equal(uuid, i.uuid, 'uuid') assert_equal(protocol, i.protocol, 'protocol') assert_equal(, i., 'options') end |
#test_parser ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 71 def test_parser handle = '6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_ip_tcp:10.4.10.10[80]' i = Klass.parse( handle ) assert(i) assert_equal(['6bffd098-a112-3610-9833-46c3f87e345a', '1.0'], i.uuid, 'uuid') assert_equal('ncacn_ip_tcp', i.protocol, 'protocol') assert_equal('10.4.10.10', i.address, 'address') assert_equal(['80'], i., 'options') end |
#test_parser_invalid ⇒ Object
81 82 83 84 |
# File 'lib/rex/proto/dcerpc/handle.rb.ut.rb', line 81 def test_parser_invalid handle = '6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_ip_tcp:10.4.10.10[80' assert_raise(Rex::ArgumentError, 'invalid handle (parser)') { Klass.parse(handle) } end |