Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Spencer McIntyre <58950994+smcintyre-r7@users.noreply.github.com>
  • Loading branch information
jheysel-r7 and smcintyre-r7 committed Apr 29, 2024
1 parent 6c74d14 commit 6055d8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/msf/core/auxiliary/rocketmq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def send_version_request
begin
connect
sock.send(header + data_length + data, 0)
res_length = sock.timed_read(4).unpack1('N')
res_length = sock.timed_read(4)&.unpack1('N')
return nil if res_length.nil?

res = sock.timed_read(res_length)
rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError => e
print_error("Unable to connect: #{e.class} #{e.message}\n#{e.backtrace * "\n"}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def initialize(info = {})
def check
connect

len = sock.timed_read(4).unpack1('N')
len = sock.timed_read(4)&.unpack1('N')

return CheckCode::Unknown if len > 0x2000 # upper limit in case the service isn't ActiveMQ
return CheckCode::Unknown if len.nil? || len > 0x2000 # upper limit in case the service isn't ActiveMQ

res = sock.timed_read(len)

Expand Down

0 comments on commit 6055d8a

Please sign in to comment.