@@ -71,11 +71,23 @@ def login_credentials(credential_data)
71
71
def create_credential_login ( credential_data )
72
72
return super unless framework . features . enabled? ( Msf ::FeatureManager ::SHOW_SUCCESSFUL_LOGINS ) && datastore [ 'ShowSuccessfulLogins' ] && @report
73
73
74
- @report [ rhost ] = { successful_logins : [ ] }
74
+ @report [ rhost ] ||= { }
75
+ @report [ rhost ] [ :successful_logins ] ||= [ ]
75
76
@report [ rhost ] [ :successful_logins ] << login_credentials ( credential_data )
76
77
super
77
78
end
78
79
80
+ def report_successful_login ( public :, private :)
81
+ return super unless framework . features . enabled? ( Msf ::FeatureManager ::SHOW_SUCCESSFUL_LOGINS ) && datastore [ 'ShowSuccessfulLogins' ] && @report
82
+
83
+ @report [ rhost ] ||= { }
84
+ @report [ rhost ] [ :successful_logins ] ||= [ ]
85
+ @report [ rhost ] [ :successful_logins ] << {
86
+ public : public ,
87
+ private_data : private
88
+ }
89
+ end
90
+
79
91
# Creates a credential and adds to to the DB if one is present, then calls create_credential_login to
80
92
# attempt a login
81
93
#
@@ -90,7 +102,8 @@ def create_credential_login(credential_data)
90
102
def create_credential_and_login ( credential_data )
91
103
return super unless framework . features . enabled? ( Msf ::FeatureManager ::SHOW_SUCCESSFUL_LOGINS ) && datastore [ 'ShowSuccessfulLogins' ] && @report
92
104
93
- @report [ rhost ] = { successful_logins : [ ] }
105
+ @report [ rhost ] ||= { }
106
+ @report [ rhost ] [ :successful_logins ] ||= [ ]
94
107
@report [ rhost ] [ :successful_logins ] << login_credentials ( credential_data )
95
108
super
96
109
end
@@ -107,14 +120,9 @@ def create_credential_and_login(credential_data)
107
120
def start_session ( obj , info , ds_merge , crlf = false , sock = nil , sess = nil )
108
121
return super unless framework . features . enabled? ( Msf ::FeatureManager ::SHOW_SUCCESSFUL_LOGINS ) && datastore [ 'ShowSuccessfulLogins' ]
109
122
110
- unless @report && @report [ rhost ]
111
- elog ( "No RHOST found in report, skipping reporting for #{ rhost } " )
112
- print_brute level : :error , ip : rhost , msg : "No RHOST found in report, skipping reporting for #{ rhost } "
113
- return super
114
- end
115
-
116
123
result = super
117
- @report [ rhost ] . merge! ( { successful_sessions : [ ] } )
124
+ @report [ rhost ] ||= { }
125
+ @report [ rhost ] [ :successful_sessions ] ||= [ ]
118
126
@report [ rhost ] [ :successful_sessions ] << result
119
127
result
120
128
end
@@ -127,6 +135,7 @@ def start_session(obj, info, ds_merge, crlf = false, sock = nil, sess = nil)
127
135
#
128
136
# @return [Hash] Rhost keys mapped to successful logins and sessions for each host
129
137
def print_report_summary
138
+ return unless @report
130
139
report = @report
131
140
132
141
logins = report . flat_map { |_k , v | v [ :successful_logins ] } . compact
0 commit comments