Class: Rex::Proto::DCERPC::Handle
- Inherits:
-
Object
- Object
- Rex::Proto::DCERPC::Handle
- Defined in:
- lib/rex/proto/dcerpc/handle.rb
Constant Summary collapse
- @@protocols =
['ncacn_ip_tcp', 'ncacn_ip_udp', 'ncacn_np', 'ncacn_http']
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#options ⇒ Object
Returns the value of attribute options.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
-
.parse(handle) ⇒ Object
instantiate a handle object, by parsing a string binding handle.
Instance Method Summary collapse
-
#initialize(uuid, protocol, address, options) ⇒ Handle
constructor
instantiate a handle object, akin to Microsoft’s string binding handle by values.
-
#to_s ⇒ Object
stringify a handle.
Constructor Details
#initialize(uuid, protocol, address, options) ⇒ Handle
instantiate a handle object, akin to Microsoft’s string binding handle by values
12 13 14 15 16 17 18 19 20 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 12 def initialize(uuid, protocol, address, ) raise ArgumentError if !Rex::Proto raise ArgumentError if !Rex::Proto::DCERPC::UUID.is?(uuid[0]) raise ArgumentError if !@@protocols.include?(protocol) self.uuid = uuid self.protocol = protocol self.address = address self. = end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
9 10 11 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 9 def address @address end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 9 def @options end |
#protocol ⇒ Object
Returns the value of attribute protocol.
9 10 11 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 9 def protocol @protocol end |
#uuid ⇒ Object
Returns the value of attribute uuid.
9 10 11 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 9 def uuid @uuid end |
Class Method Details
.parse(handle) ⇒ Object
instantiate a handle object, by parsing a string binding handle
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 23 def self.parse (handle) uuid_re = '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}' rev_re = '\d+.\d+' proto_re = '(?:' + @@protocols.join('|') + ')' re = Regexp.new("(#{uuid_re}):(#{rev_re})\@(#{proto_re}):(.*?)\\[(.*)\\]$", Regexp::IGNORECASE | Regexp::NOENCODING) match = re.match(handle) raise ArgumentError if !match uuid = [match[1], match[2]] protocol = match[3] address = match[4] = match[5].split(',') i = Rex::Proto::DCERPC::Handle.new(uuid, protocol, address, ) return i end |
Instance Method Details
#to_s ⇒ Object
stringify a handle
40 41 42 |
# File 'lib/rex/proto/dcerpc/handle.rb', line 40 def to_s self.uuid.join(':') + '@' + self.protocol + ':' + self.address + '[' + self..join(', ') + ']' end |