Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix indentation
  • Loading branch information
egypt committed May 1, 2012
1 parent 194c090 commit 1c03c2b
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions modules/auxiliary/scanner/smb/smb_enumshares.rb
Expand Up @@ -167,43 +167,42 @@ def run_host(ip)
@shares = []

[[139, false], [445, true]].each do |info|

datastore['RPORT'] = info[0]
datastore['SMBDirect'] = info[1]

begin
connect
smb_login
if datastore['USE_SRVSVC_ONLY']
srvsvc_netshareenum
else
#If not implemented by target, will fall back to srvsvc_netshareenum
lanman_netshareenum
end

if not @shares.empty?
print_status("#{ip}:#{rport} #{@shares.map{|x| "#{x[0]} - #{x[2]} (#{x[1]})" }.join(", ")}")
report_note(
:host => ip,
:proto => 'tcp',
:port => rport,
:type => 'smb.shares',
:data => { :shares => @shares },
:update => :unique_data
)
datastore['RPORT'] = info[0]
datastore['SMBDirect'] = info[1]

begin
connect
smb_login
if datastore['USE_SRVSVC_ONLY']
srvsvc_netshareenum
else
#If not implemented by target, will fall back to srvsvc_netshareenum
lanman_netshareenum
end

if not @shares.empty?
print_status("#{ip}:#{rport} #{@shares.map{|x| "#{x[0]} - #{x[2]} (#{x[1]})" }.join(", ")}")
report_note(
:host => ip,
:proto => 'tcp',
:port => rport,
:type => 'smb.shares',
:data => { :shares => @shares },
:update => :unique_data
)
end

disconnect
return
rescue ::Timeout::Error
rescue ::Interrupt
raise $!
rescue ::Rex::ConnectionError
rescue ::Rex::Proto::SMB::Exceptions::LoginError
next
rescue ::Exception => e
print_line("Error: #{ip} #{e.class} #{e}")
end

disconnect
return
rescue ::Timeout::Error
rescue ::Interrupt
raise $!
rescue ::Rex::ConnectionError
rescue ::Rex::Proto::SMB::Exceptions::LoginError
next
rescue ::Exception => e
print_line("Error: #{ip} #{e.class} #{e}")
end
end
end

Expand Down

0 comments on commit 1c03c2b

Please sign in to comment.