@@ -27,17 +27,31 @@ def initialize
27
27
] , self . class )
28
28
29
29
register_autofilter_ports ( [ 80 ] )
30
-
31
- #username is hardcoded into application
30
+
31
+ # username is hardcoded into application
32
32
deregister_options ( 'RHOST' , 'USERNAME' , 'USER_FILE' , 'USER_AS_PASS' , 'DB_ALL_USERS' )
33
33
end
34
34
35
+ def setup
36
+ super
37
+ # They must select at least blank passwords, provide a pass file or a password
38
+ one_required = %w( BLANK_PASSWORDS PASS_FILE PASSWORD )
39
+ unless one_required . any? { |o | datastore . has_key? ( o ) && datastore [ o ] }
40
+ fail_with ( Failure ::BadConfig , "Invalid options: One of #{ one_required . join ( ', ' ) } must be set" )
41
+ end
42
+ if !datastore [ 'PASS_FILE' ]
43
+ if !datastore [ 'BLANK_PASSWORDS' ] && datastore [ 'PASSWORD' ] . blank?
44
+ fail_with ( Failure ::BadConfig , "PASSWORD or PASS_FILE must be set to a non-empty string if not BLANK_PASSWORDS" )
45
+ end
46
+ end
47
+ end
48
+
35
49
def run_host ( ip )
36
50
cred_collection = Metasploit ::Framework ::CredentialCollection . new (
37
- blank_passwords : datastore [ 'BLANK_PASSWORDS' ] ,
38
- pass_file : datastore [ 'PASS_FILE' ] ,
39
- password : datastore [ 'PASSWORD' ] ,
40
- username : 'admin'
51
+ blank_passwords : datastore [ 'BLANK_PASSWORDS' ] ,
52
+ pass_file : datastore [ 'PASS_FILE' ] ,
53
+ password : datastore [ 'PASSWORD' ] ,
54
+ username : 'admin'
41
55
)
42
56
43
57
scanner = Metasploit ::Framework ::LoginScanner ::MyBookLive . new (
@@ -59,8 +73,8 @@ def run_host(ip)
59
73
scanner . scan! do |result |
60
74
credential_data = result . to_h
61
75
credential_data . merge! (
62
- module_fullname : fullname ,
63
- workspace_id : myworkspace_id
76
+ module_fullname : fullname ,
77
+ workspace_id : myworkspace_id
64
78
)
65
79
if result . success?
66
80
credential_core = create_credential ( credential_data )
@@ -70,7 +84,7 @@ def run_host(ip)
70
84
print_good "#{ ip } :#{ rport } - LOGIN SUCCESSFUL: #{ result . credential } "
71
85
else
72
86
invalidate_login ( credential_data )
73
- print_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } )"
87
+ vprint_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } )"
74
88
end
75
89
end
76
90
end
0 commit comments