ronin-rb / ronin

Ronin is a Free and Open Source Ruby Toolkit for Security Research and Development. Ronin also allows for the rapid development and distribution of code, exploits, payloads, etc, via 3rd-party git repositories.
https://ronin-rb.dev
GNU General Public License v3.0
694 stars 50 forks source link

Better handle raised errors in the `ronin netcat` command #118

Closed postmodern closed 2 years ago

postmodern commented 2 years ago

Better handle when errors occur in the Async event loop.

$ ./bin/ronin netcat -v --tls example.com 443
>>> Connecting to example.com:443 ...
GET / HTTP/1.1
 4.74s     warn: Async::Task [oid=0x1338] [ec=0x134c] [pid=10942] [2022-10-07 10:46:41 -0700]
               | Task may have ended with unhandled exception.
               |   Errno::ECONNRESET: Connection reset by peer
               |   → /opt/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:452 in `__read_nonblock'
               |     /opt/rubies/ruby-3.1.2/lib/ruby/3.1.0/socket.rb:452 in `read_nonblock'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/generic.rb:216 in `async_send'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/generic.rb:69 in `block in wrap_blocking_method'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/stream.rb:261 in `fill_read_buffer'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-io-1.34.0/lib/async/io/stream.rb:99 in `read_partial'
               |     lib/ronin/cli/commands/netcat.rb:311 in `block (2 levels) in client_loop'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/task.rb:107 in `block in run'
               |     /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.1.0/gems/async-2.1.0/lib/async/task.rb:243 in `block in schedule'

:(

postmodern commented 2 years ago

Fixed by 133a190.