Class: RubySMB::Dcerpc::Handle
- Inherits:
-
Object
- Object
- RubySMB::Dcerpc::Handle
- Defined in:
- lib/ruby_smb/dcerpc/handle.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#last_msg ⇒ Object
Returns the value of attribute last_msg.
-
#pipe ⇒ Object
Returns the value of attribute pipe.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #bind(options = {}) ⇒ Object
- #handle_msg(msg) ⇒ Object
- #initialize(named_pipe) ⇒ RubySMB::Dcerpc::Handle constructor
- #ioctl_request(action, options = {}) ⇒ Object
- #request(opnum:, stub:, options: {}) ⇒ Object
Constructor Details
#initialize(named_pipe) ⇒ RubySMB::Dcerpc::Handle
17 18 19 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 17 def initialize(named_pipe) @pipe = named_pipe end |
Instance Attribute Details
#last_msg ⇒ Object
Returns the value of attribute last_msg.
6 7 8 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 6 def last_msg @last_msg end |
#pipe ⇒ Object
Returns the value of attribute pipe.
5 6 7 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 5 def pipe @pipe end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 7 def response @response end |
Instance Method Details
#bind(options = {}) ⇒ Object
22 23 24 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 22 def bind(={}) ioctl_request(RubySMB::Dcerpc::Bind.new()) end |
#handle_msg(msg) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 48 def handle_msg(msg) data = msg.buffer.to_binary_s headz = RubySMB::Dcerpc::PduHeader.read(data) pdu = PTYPES[headz.ptype] if pdu dcerpc_response_stub = pdu.read(msg.output_data).stub @response = dcerpc_response_stub.to_binary_s end data end |
#ioctl_request(action, options = {}) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/ruby_smb/dcerpc/handle.rb', line 38 def ioctl_request(action, ={}) request = @pipe.set_header_fields(RubySMB::SMB2::Packet::IoctlRequest.new()) request.ctl_code = 0x0011C017 request.flags.is_fsctl = 0x00000001 request.buffer = action.to_binary_s @last_msg = @pipe.tree.client.send_recv(request) handle_msg(RubySMB::SMB2::Packet::IoctlResponse.read(@last_msg)) end |