@@ -27,17 +27,25 @@ 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
+ # They must select at least blank passwords, provide a pass file or a password
37
+ one_required = %w( BLANK_PASSWORDS PASS_FILE PASSWORD )
38
+ unless one_required . any? { |o | datastore [ o ] }
39
+ fail_with ( Failure ::BadConfig , "Invalid options: One of #{ one_required . join ( ', ' ) } must be set" )
40
+ end
41
+ end
42
+
35
43
def run_host ( ip )
36
44
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'
45
+ blank_passwords : datastore [ 'BLANK_PASSWORDS' ] ,
46
+ pass_file : datastore [ 'PASS_FILE' ] ,
47
+ password : datastore [ 'PASSWORD' ] ,
48
+ username : 'admin'
41
49
)
42
50
43
51
scanner = Metasploit ::Framework ::LoginScanner ::MyBookLive . new (
@@ -59,8 +67,8 @@ def run_host(ip)
59
67
scanner . scan! do |result |
60
68
credential_data = result . to_h
61
69
credential_data . merge! (
62
- module_fullname : fullname ,
63
- workspace_id : myworkspace_id
70
+ module_fullname : fullname ,
71
+ workspace_id : myworkspace_id
64
72
)
65
73
if result . success?
66
74
credential_core = create_credential ( credential_data )
@@ -70,7 +78,7 @@ def run_host(ip)
70
78
print_good "#{ ip } :#{ rport } - LOGIN SUCCESSFUL: #{ result . credential } "
71
79
else
72
80
invalidate_login ( credential_data )
73
- print_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } )"
81
+ vprint_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } )"
74
82
end
75
83
end
76
84
end
0 commit comments