ronin-rb / ronin-support

A support library for Ronin. Like activesupport, but for hacking!
https://ronin-rb.dev
GNU Lesser General Public License v3.0
25 stars 9 forks source link

Add `UDP.recv` and `udp_recv` #507

Open postmodern opened 2 months ago

postmodern commented 2 months ago

To compliment UDP.send and udp_send, there should be UDP.recv and UDP::Mixin#udp_recv methods. These methods should call connect with the host and port arguments, then calls .recv(1024) to read the first chunk of data sent through the connection. This method is similar to UDP.banner and udp_banner, but it reads the whole packet of data and doesn't stop at the first newline.

data = UDP.recv(host,port)
data = UDP.recv(host,port, length: 4096)
include Network::UDP::Mixin

data = udp_recv(host,port)
data = udp_recv(host,port, length: 4096)