|
40 | 40 | if (!isset($_SESSION['XSS'])) $_SESSION['XSS']=get_rand_str(16); |
41 | 41 | $xurl='XSS='.$_SESSION['XSS']; |
42 | 42 |
|
43 | | - ini_set('display_errors',1); #turn on to debug db or script issues |
| 43 | + ini_set('display_errors',0); #turn on to debug db or script issues |
44 | 44 | error_reporting(E_ALL ^ E_NOTICE); |
45 | 45 |
|
46 | 46 | //strip quotes if they set |
@@ -205,56 +205,57 @@ function display_select($sth,$q){ |
205 | 205 | $headers.="<th>".$meta->name."</th>"; |
206 | 206 | } |
207 | 207 | if ($is_shd) $headers.="<th>show create database</th><th>show table status</th><th>show triggers</th>"; |
208 | | - if ($is_sht) $headers.="<th>engine</th><th>~rows</th><th>data size</th><th>index size</th><th>show create table</th><th>explain</th><th>indexes</th><th>export</th><th>drop</th><th>truncate</th><th>optimize</th><th>repair</th>"; |
| 208 | + if ($is_sht) $headers.="<th>engine</th><th>~rows</th><th>data size</th><th>index size</th><th>show create table</th><th>explain</th><th>indexes</th><th>export</th><th>drop</th><th>truncate</th><th>optimize</th><th>repair</th><th>comment</th>"; |
209 | 209 | $headers.="</tr>\n"; |
210 | 210 | $sqldr.=$headers; |
211 | 211 | $swapper=false; |
212 | 212 | while($row=mysqli_fetch_row($sth)){ |
213 | 213 | $sqldr.="<tr class='".$rc[$swp=!$swp]."' onclick='tc(this)'>"; |
214 | | - for($i=0;$i<$fields_num;$i++){ |
215 | | - $v=$row[$i];$more=''; |
216 | | - if ($is_sht && $v){ |
217 | | - if ($i>0) break; |
218 | | - $vq='`'.$v.'`'; |
219 | | - $url='?'.$xurl."&db=$dbn"; |
220 | | - $v="<input type='checkbox' name='cb[]' value=\"$vq\"></td>" |
221 | | - ."<td><a href=\"$url&q=".b64e("select * from {$vq}")."\">$v</a></td>" |
222 | | - ."<td>".$row[1]."</td>" |
223 | | - ."<td align='right'>".$row[4]."</td>" |
224 | | - ."<td align='right'>".$row[6]."</td>" |
225 | | - ."<td align='right'>".$row[8]."</td>" |
226 | | - ."<td>·<a href=\"$url&q=".b64e("show create table {$vq}")."\">sct</a></td>" |
227 | | - ."<td>·<a href=\"$url&q=".b64e("explain {$vq}")."\">exp</a></td>" |
228 | | - ."<td>·<a href=\"$url&q=".b64e("show index from {$vq}")."\">ind</a></td>" |
229 | | - ."<td>·<a href=\"$url&shex=1&t=$vq\">export</a></td>" |
230 | | - ."<td>·<a href=\"$url&q=".b64e("drop table {$vq}")."\" onclick='return ays()'>dr</a></td>" |
231 | | - ."<td>·<a href=\"$url&q=".b64e("truncate table {$vq}")."\" onclick='return ays()'>tr</a></td>" |
232 | | - ."<td>·<a href=\"$url&q=".b64e("optimize table {$vq}")."\" onclick='return ays()'>opt</a></td>" |
233 | | - ."<td>·<a href=\"$url&q=".b64e("repair table {$vq}")."\" onclick='return ays()'>rpr</a>"; |
234 | | - }elseif ($is_shd && $i==0 && $v){ |
235 | | - $url='?'.$xurl."&db=$v"; |
236 | | - $v="<a href=\"$url&q=".b64e("SHOW TABLE STATUS")."\">$v</a></td>" |
237 | | - ."<td><a href=\"$url&q=".b64e("show create database `{$v}`")."\">scd</a></td>" |
238 | | - ."<td><a href=\"$url&q=".b64e("show table status")."\">status</a></td>" |
239 | | - ."<td><a href=\"$url&q=".b64e("show triggers")."\">trig</a>" |
240 | | - ; |
241 | | - }else{ |
242 | | - if (is_null($v)) $v="NULL"; |
243 | | - elseif (preg_match('/[\x00-\x09\x0B\x0C\x0E-\x1F]+/',$v)) { #all chars <32, except \n\r(0D0A) |
244 | | - $vl=strlen($v);$pf=''; |
245 | | - if ($vl>16 && $fields_num>1){#show full dump if just one field |
246 | | - $v=substr($v, 0, 16);$pf='...'; |
247 | | - } |
248 | | - $v='BINARY: '.chunk_split(strtoupper(bin2hex($v)),2,' ').$pf; |
249 | | - }else $v=htmlspecialchars($v); |
250 | | - } |
| 214 | + $v=$row[0]; |
| 215 | + if ($is_sht){ |
| 216 | + $vq='`'.$v.'`'; |
| 217 | + $url='?'.$xurl."&db=$dbn"; |
| 218 | + $v="<input type='checkbox' name='cb[]' value=\"$vq\"></td>" |
| 219 | + ."<td><a href=\"$url&q=".b64e("select * from $vq")."\">$v</a></td>" |
| 220 | + ."<td>".$row[1]."</td>" |
| 221 | + ."<td align='right'>".$row[4]."</td>" |
| 222 | + ."<td align='right'>".$row[6]."</td>" |
| 223 | + ."<td align='right'>".$row[8]."</td>" |
| 224 | + ."<td>·<a href=\"$url&q=".b64e("show create table $vq")."\">sct</a></td>" |
| 225 | + ."<td>·<a href=\"$url&q=".b64e("explain $vq")."\">exp</a></td>" |
| 226 | + ."<td>·<a href=\"$url&q=".b64e("show index from $vq")."\">ind</a></td>" |
| 227 | + ."<td>·<a href=\"$url&shex=1&t=$vq\">export</a></td>" |
| 228 | + ."<td>·<a href=\"$url&q=".b64e("drop table $vq")."\" onclick='return ays()'>dr</a></td>" |
| 229 | + ."<td>·<a href=\"$url&q=".b64e("truncate table $vq")."\" onclick='return ays()'>tr</a></td>" |
| 230 | + ."<td>·<a href=\"$url&q=".b64e("optimize table $vq")."\" onclick='return ays()'>opt</a></td>" |
| 231 | + ."<td>·<a href=\"$url&q=".b64e("repair table $vq")."\" onclick='return ays()'>rpr</a></td>" |
| 232 | + ."<td>".hs($row[$fields_num-1]); |
| 233 | + $sqldr.="<td>$v</td>"; |
| 234 | + }elseif ($is_shd){ |
| 235 | + $url='?'.$xurl."&db=$v"; |
| 236 | + $v="<a href=\"$url&q=".b64e("SHOW TABLE STATUS")."\">$v</a></td>" |
| 237 | + ."<td><a href=\"$url&q=".b64e("show create database `$v`")."\">scd</a></td>" |
| 238 | + ."<td><a href=\"$url&q=".b64e("show table status")."\">status</a></td>" |
| 239 | + ."<td><a href=\"$url&q=".b64e("show triggers")."\">trig</a>"; |
| 240 | + $sqldr.="<td>$v</td>"; |
| 241 | + }else{ |
| 242 | + for($i=0;$i<$fields_num;$i++){ |
| 243 | + $v=$row[$i]; |
| 244 | + if (is_null($v)) $v="NULL"; |
| 245 | + elseif (preg_match('/[\x00-\x09\x0B\x0C\x0E-\x1F]+/',$v)) { #all chars <32, except \n\r(0D0A) |
| 246 | + $vl=strlen($v);$pf=''; |
| 247 | + if ($vl>16 && $fields_num>1){#show full dump if just one field |
| 248 | + $v=substr($v, 0, 16);$pf='...'; |
| 249 | + } |
| 250 | + $v='BINARY: '.chunk_split(strtoupper(bin2hex($v)),2,' ').$pf; |
| 251 | + }else $v=hs($v); |
251 | 252 | if ($is_show_crt) $v="<pre>$v</pre>"; |
252 | 253 | $sqldr.="<td>$v".(!strlen($v)?"<br>":'')."</td>"; |
| 254 | + } |
253 | 255 | } |
254 | 256 | $sqldr.="</tr>\n"; |
255 | 257 | } |
256 | 258 | $sqldr.="</table>\n".$abtn; |
257 | | - |
258 | 259 | } |
259 | 260 |
|
260 | 261 | function print_header(){ |
@@ -465,7 +466,7 @@ function print_screen(){ |
465 | 466 | function print_footer(){ |
466 | 467 | ?> |
467 | 468 | </form> |
468 | | -<div class="ft">© 2004-2015 <a href="http://osalabs.com" target="_blank">Oleg Savchuk</a></div> |
| 469 | +<div class="ft">© 2004-2016 <a href="http://osalabs.com" target="_blank">Oleg Savchuk</a></div> |
469 | 470 | </body></html> |
470 | 471 | <?php |
471 | 472 | } |
@@ -1156,7 +1157,7 @@ function check_xss(){ |
1156 | 1157 | } |
1157 | 1158 |
|
1158 | 1159 | function rw($s){#for debug |
1159 | | - echo hs($s)."<br>\n"; |
| 1160 | + echo hs(var_dump($s))."<br>\n"; |
1160 | 1161 | } |
1161 | 1162 |
|
1162 | 1163 | function tmp_name() { |
|
0 commit comments