Skip to content

Commit 14b3e64

Browse files
committed
Check nil
1 parent ca08804 commit 14b3e64

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/auxiliary/scanner/smb/smb_enumshares.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ def lanman_netshareenum(ip, rport, info)
187187
end
188188
end
189189

190+
return [] if res.nil?
191+
190192
lerror, lconv, lentries, lcount = res['Payload'].to_s[
191193
res['Payload'].v['ParamOffset'],
192194
res['Payload'].v['ParamCount']
@@ -358,10 +360,11 @@ def run_host(ip)
358360
print_status("#{ip}:#{rport} - #{os_info}") if os_info
359361

360362
shares_info = shares.map{|x| "#{x[0]} - #{x[2]} (#{x[1]})" }.join(", ")
361-
print_status("#{ip}:#{rport} - #{shares_info}")
362-
363-
unless shares.empty?
364-
report_note(
363+
if shares.empty?
364+
print_status("#{ip}:#{rport} - No shares collected")
365+
else
366+
print_status("#{ip}:#{rport} - #{shares_info}")
367+
report_note(
365368
:host => ip,
366369
:proto => 'tcp',
367370
:port => rport,

0 commit comments

Comments
 (0)