Skip to content

Commit 16c8622

Browse files
committed
Change to OptBool and default to explicit
1 parent d40e748 commit 16c8622

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

modules/auxiliary/scanner/smb/smb_uninit_cred.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,7 @@ def initialize(info={})
5757

5858
# This is a good example of passive vs explicit check
5959
register_options([
60-
OptEnum.new('CHECK_STYLE',
61-
[
62-
true,
63-
'Explicit style will actually try to trigger the bug, otheriwse purely a banner check',
64-
'PASSIVE',
65-
['EXPLICIT', 'PASSIVE']
66-
])
60+
OptBool.new('PASSIVE', [false, 'Try banner checking instead of triggering the bug', false])
6761
])
6862

6963
# It's either 139 or 445. The user should not touch this.
@@ -224,17 +218,17 @@ def check_host(ip)
224218
return Exploit::CheckCode::Safe
225219
end
226220

227-
case datastore['CHECK_STYLE']
228-
when /explicit/i
229-
if is_vulnerable?(ip)
230-
flag_vuln_host(ip, samba_info)
231-
return Exploit::CheckCode::Vulnerable
232-
end
233-
when /passive/i
221+
if datastore['PASSIVE']
234222
if maybe_vulnerable?(samba_info)
235223
flag_vuln_host(ip, samba_info)
236224
return Exploit::CheckCode::Appears
237225
end
226+
else
227+
# Explicit: Actually triggers the bug
228+
if is_vulnerable?(ip)
229+
flag_vuln_host(ip, samba_info)
230+
return Exploit::CheckCode::Vulnerable
231+
end
238232
end
239233
end
240234

0 commit comments

Comments
 (0)