Class: Rex::Post::Meterpreter::Datagram
- Includes:
- IO::DatagramAbstraction, SocketAbstraction
- Defined in:
- lib/rex/post/meterpreter/channels/datagram.rb
Overview
Stream
This class represents a channel that is streaming. This means that sequential data is flowing in either one or both directions.
Direct Known Subclasses
Defined Under Namespace
Modules: SocketInterface
Instance Attribute Summary
Attributes inherited from Channel
#cid, #client, #cls, #flags, #params, #type
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SocketAbstraction
#_write, #cleanup, #dio_close_handler, #initialize
Methods inherited from Channel
#_close, _close, #_read, #_write, #cleanup, #close, #close_read, #close_write, #closed?, create, #dio_close_handler, #dio_handler, #dio_map, #dio_read_handler, finalize, #flag?, #initialize, #interactive, #read, request_handler, #synchronous?, #write
Methods included from InboundPacketHandler
#request_handler, #response_handler
Class Method Details
.cls ⇒ Object
25 26 27 |
# File 'lib/rex/post/meterpreter/channels/datagram.rb', line 25 def cls return CHANNEL_CLASS_DATAGRAM end |
Instance Method Details
#dio_write_handler(packet, data) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/rex/post/meterpreter/channels/datagram.rb', line 54 def dio_write_handler(packet, data) @recvd ||= [] @recvd << [packet, data] peerhost = packet.get_tlv_value( Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_PEER_HOST ) peerport = packet.get_tlv_value( Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_PEER_PORT ) if peerhost && peerport # A datagram can be maximum 65507 bytes, truncate longer messages rsock.syswrite(data[0..65506]) # We write the data and sockaddr data to the local socket, the pop it # back in recvfrom_nonblock. rsock.syswrite(Rex::Socket.to_sockaddr(peerhost, peerport)) return true else return false end end |