Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Conversation

J12934
Copy link
Contributor

@J12934 J12934 commented Aug 27, 2019

Hello 👋
I was scanning a network with ssh_scan but was always crashing at the same host with the following error code:

/usr/local/lib/ruby/2.6.0/socket.rb:1213:in `__connect_nonblock': Protocol not available - connect(2) for 192.168.42.42:22 (Errno::ENOPROTOOPT)
        from /usr/local/lib/ruby/2.6.0/socket.rb:1213:in `connect_nonblock'
        from /usr/local/lib/ruby/2.6.0/socket.rb:56:in `connect_internal'
        from /usr/local/lib/ruby/2.6.0/socket.rb:137:in `connect'
        from /usr/local/lib/ruby/2.6.0/socket.rb:641:in `block in tcp'
        from /usr/local/lib/ruby/2.6.0/socket.rb:227:in `each'
        from /usr/local/lib/ruby/2.6.0/socket.rb:227:in `foreach'
        from /usr/local/lib/ruby/2.6.0/socket.rb:631:in `tcp'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/client.rb:48:in `block in connect'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/client.rb:47:in `connect'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/scan_engine.rb:75:in `scan_target'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/scan_engine.rb:184:in `block (2 levels) in scan'
/usr/local/lib/ruby/2.6.0/socket.rb:1213:in `__connect_nonblock': Protocol not available - connect(2) for 192.168.42.42:22 (Errno::ENOPROTOOPT)
        from /usr/local/lib/ruby/2.6.0/socket.rb:1213:in `connect_nonblock'
        from /usr/local/lib/ruby/2.6.0/socket.rb:56:in `connect_internal'
        from /usr/local/lib/ruby/2.6.0/socket.rb:137:in `connect'
        from /usr/local/lib/ruby/2.6.0/socket.rb:641:in `block in tcp'
        from /usr/local/lib/ruby/2.6.0/socket.rb:227:in `each'
        from /usr/local/lib/ruby/2.6.0/socket.rb:227:in `foreach'
        from /usr/local/lib/ruby/2.6.0/socket.rb:631:in `tcp'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/client.rb:48:in `block in connect'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:33:in `catch'
        from /usr/local/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/client.rb:47:in `connect'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/scan_engine.rb:75:in `scan_target'
        from /usr/local/bundle/gems/ssh_scan-0.0.41/lib/ssh_scan/scan_engine.rb:184:in `block (2 levels) in scan'

I found that client.rb appeared to be missing a rescue block for ENOPROTOOPT error codes. If I am mistaken on that please do tell ;)

Wanted to add tests for the change, but didn't find any in https://github.com/mozilla/ssh_scan/blob/master/spec/ssh_scan/client_spec.rb so I skipped it for now.

@claudijd claudijd merged commit d18f70c into mozilla:master Aug 27, 2019
@claudijd
Copy link
Contributor

@J12934 thanks! I'll cut a new gem release today to include this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants