|
4 | 4 | # |
5 | 5 | # This class represents a Microsoft SQL Server Injection object, its primary purpose is to provide the common queries |
6 | 6 | # needed when performing SQL injection. |
7 | | -# Instanciate it only if you get the query results of your SQL injection returned on the response. |
| 7 | +# Instantiate it only if you get the query results of your SQL injection returned on the response. |
8 | 8 | # |
9 | 9 | module Msf::Exploit::SQLi::Mssqli |
10 | 10 | class Common < Msf::Exploit::SQLi::Common |
@@ -123,23 +123,15 @@ def enum_table_columns(table_name) |
123 | 123 | def dump_table_fields(table, columns, condition = '', num_limit = 0) |
124 | 124 | return '' if columns.empty? |
125 | 125 |
|
126 | | - one_column = columns.length == 1 |
127 | | - column_names = columns |
128 | | - |
129 | | - if one_column |
130 | | - columns = "cast(isnull(#{columns.first},'#{@null_replacement}') as varchar(max))" |
131 | | - columns = @encoder[:encode].sub(/\^DATA\^/, columns) if @encoder |
132 | | - else |
133 | | - columns = columns.map do |col| |
134 | | - col = "cast(isnull(#{col},'#{@null_replacement}') as varchar(max))" |
135 | | - @encoder ? @encoder[:encode].sub(/\^DATA\^/, col) : col |
136 | | - end.join("+'#{@second_concat_separator}'+") |
137 | | - end |
| 126 | + columns = columns.map do |col| |
| 127 | + col = "cast(isnull(#{col},'#{@null_replacement}') as varchar(max))" |
| 128 | + @encoder ? @encoder[:encode].sub(/\^DATA\^/, col) : col |
| 129 | + end.join("+'#{@second_concat_separator}'+") |
138 | 130 | unless condition.empty? |
139 | 131 | condition = ' where ' + condition |
140 | 132 | end |
141 | 133 | num_limit = num_limit.to_i |
142 | | - limit = num_limit > 0 ? ' top ' + num_limit.to_s : '' |
| 134 | + limit = num_limit > 0 ? " top #{num_limit}" : '' |
143 | 135 | retrieved_data = nil |
144 | 136 | identifier_generator = Rex::RandomIdentifier::Generator.new |
145 | 137 | if @safe |
|
0 commit comments