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 `TCP.recv` and `tcp_recv` #506

Open postmodern opened 2 months ago

postmodern commented 2 months ago

To compliment TCP.send and tcp_send, there should be TCP.recv and TCP::Mixin#tcp_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 TCP.banner and tcp_banner, but it reads the whole packet of data and doesn't stop at the first newline.

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

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