Module: Msf::Sessions::Modem::UdpChannel::SocketInterface

Includes:
ChannelSocketInterface
Defined in:
lib/msf/base/sessions/modem.rb

Instance Attribute Summary

Attributes included from Rex::Post::Channel::SocketAbstraction::SocketInterface

#channel

Instance Method Summary collapse

Methods included from ChannelSocketInterface

#close, #getsockname

Methods included from Rex::Post::Channel::SocketAbstraction::SocketInterface

#getpeername, #getsockname

Instance Method Details

#recvfrom_nonblock(length, flags = 0) ⇒ Array(String, String)

Read one datagram and use the channel's fixed peer address. Sending the address separately allows readers to run before it is available.

Parameters:

  • length (Integer) —

    maximum number of payload bytes to receive

  • flags (Integer) (defaults to: 0) —

    flags passed to the underlying socket read

Returns:

  • (Array(String, String)) —

    the payload and packed peer address



289
290
291
# File 'lib/msf/base/sessions/modem.rb', line 289

def recvfrom_nonblock(length, flags = 0)
  [super(length, flags)[0], channel.sockaddr.dup]
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

Returns:

  • (Boolean)


278
279
280
# File 'lib/msf/base/sessions/modem.rb', line 278

def type?
  'udp'
end