123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #!/bin/bash
-
- # Prompt the user to enter the value of HOSTNAME
- read -p "Enter the HOSTNAME: " HOSTNAME
-
- # Function to obtain access token for a given email and password
- get_access_token() {
- local email=$1
- local password=$2
-
- # Use curl to get the access token and jq to extract it
- local access_token=$(curl "http://$HOSTNAME/identity/api/auth/login" \
- -H 'Content-Type: application/json' \
- --data-raw '{"email":"'"$email"'","password":"'"$password"'"}' \
- --insecure -s | jq -j .token)
-
- echo "$access_token"
- }
-
- # Define the common password
- COMMON_PASSWORD='cRaPi2023!!!'
-
- # Define the email addresses
- emails=(
- 'apilab@akamai.com'
- 'apilab2@akamai.com'
- 'apilab3@akamai.com'
- 'apilab4@akamai.com'
- )
-
-
- for ((i=0; i<${#emails[@]}; i++)); do
- access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
- # Make 5 requests for report IDs 1 to 5
- for report_id in {1..5}; do
- curl "http://$HOSTNAME/workshop/api/mechanic/mechanic_report?report_id=$report_id" \
- -H 'Accept: */*' \
- -H 'Accept-Language: en-US,en;q=0.9' \
- -H "Authorization: Bearer $access_token" \
- -H 'Connection: keep-alive' \
- -H 'Content-Type: application/json' \
- -H "Referer: http://$HOSTNAME/dashboard" \
- -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36' \
- -H 'pragma: akamai-x-ro-trace' \
- -H 'x-akamai-a2-disable: on' \
- -H 'x-akamai-ro-piez: on' \
- -H 'x-im-piez: on' \
- --compressed \
- --insecure | jq -j
- done
- done
|