Module: Msf::Sessions::Modem::UdpChannel::SocketInterface
- Includes:
- ChannelSocketInterface
- Defined in:
- lib/msf/base/sessions/modem.rb
Constant Summary collapse
- MAX_SOCKADDR_LENGTH =
128
Instance Attribute Summary
Attributes included from Rex::Post::Channel::SocketAbstraction::SocketInterface
Instance Method Summary collapse
-
#recvfrom_nonblock(length, flags = 0) ⇒ Object
The reader thread writes each datagram into rsock followed by its sockaddr, so a recvfrom() pulls the data datagram then the sockaddr datagram back off the pair.
-
#send(buf, _flags = 0, _a = nil, _b = nil) ⇒ Object
UDPSocket#send-compatible signature.
- #type? ⇒ Boolean
Methods included from ChannelSocketInterface
Methods included from Rex::Post::Channel::SocketAbstraction::SocketInterface
Instance Method Details
#recvfrom_nonblock(length, flags = 0) ⇒ Object
The reader thread writes each datagram into rsock followed by its sockaddr, so a recvfrom() pulls the data datagram then the sockaddr datagram back off the pair. Mirrors Datagram::SocketInterface.
287 288 289 290 291 |
# File 'lib/msf/base/sessions/modem.rb', line 287 def recvfrom_nonblock(length, flags = 0) data = super(length, flags)[0] sockaddr = super(MAX_SOCKADDR_LENGTH, flags)[0] [data, sockaddr] end |
#send(buf, _flags = 0, _a = nil, _b = nil) ⇒ Object
UDPSocket#send-compatible signature. The modem connection is bound to a single peer (AT+QIOPEN “UDP”,“host”,port), so the explicit host/port are accepted to satisfy the interface but the datagram always goes to that peer.
299 300 301 302 |
# File 'lib/msf/base/sessions/modem.rb', line 299 def send(buf, _flags = 0, _a = nil, _b = nil) channel.dio_write(buf) buf.length end |
#type? ⇒ Boolean
278 279 280 |
# File 'lib/msf/base/sessions/modem.rb', line 278 def type? 'udp' end |