2025-08-16 00:47:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2025-09-18 00:04:23 +00:00
|
|
|
N=$(nproc --all)
|
|
|
|
|
|
2025-08-25 23:04:54 +00:00
|
|
|
function log_request_to () {
|
2025-08-16 00:47:14 +00:00
|
|
|
return_code=$(curl -Sikl -o /dev/null -w "%{http_code}" $1 2>/dev/null)
|
|
|
|
|
case ${return_code:0:1} in
|
|
|
|
|
"4" | "5")
|
|
|
|
|
echo "query of $1 returned $return_code"
|
2025-08-25 23:04:54 +00:00
|
|
|
return 1
|
2025-08-16 00:47:14 +00:00
|
|
|
;;
|
|
|
|
|
*)
|
2025-08-25 23:04:54 +00:00
|
|
|
return 0
|
2025-08-16 00:47:14 +00:00
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-25 23:04:54 +00:00
|
|
|
function sigint_handler() {
|
|
|
|
|
jobs -p | xargs kill -9
|
|
|
|
|
exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap 'sigint_handler' INT
|
|
|
|
|
|
2025-08-26 23:25:38 +00:00
|
|
|
# TODO: make this a more elegant item
|
|
|
|
|
# maybe a while loop with curl
|
2025-09-18 00:04:23 +00:00
|
|
|
sleep 2
|
2025-08-25 23:04:54 +00:00
|
|
|
|
2025-09-18 00:04:23 +00:00
|
|
|
echo "[+] client making request loop"
|
2025-10-06 16:19:20 +00:00
|
|
|
for iter in {0..80}; do
|
2025-09-18 00:04:23 +00:00
|
|
|
((i=i%N)); ((i++==0)) && wait
|
|
|
|
|
echo "request to $iter"
|
|
|
|
|
log_request_to "https://kaproxy:8080/$iter" &
|
2025-08-26 23:25:38 +00:00
|
|
|
done
|
2025-08-16 00:47:14 +00:00
|
|
|
|
2025-08-25 23:04:54 +00:00
|
|
|
wait $(jobs -p)
|