123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- #!/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'
- )
-
- # Loop through each email/password and output the corresponding access token
- for ((i=0; i<${#emails[@]}; i++)); do
- access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
- echo "GENERATING TRAFFIC FOR LOGIN API"
- echo "access_token$((i+1)): $access_token"
-
- echo "GENERATING TRAFFIC FOR DASHBOARD API (VIEW DASHBOARD)"
- for ((x=1; x<=10; x++)); do
- curl "http://$HOSTNAME/identity/api/v2/user/dashboard" \
- -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 \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
- done
-
- echo "GENERATING TRAFFIC FOR ORDERS API (PLACE ORDERS FOR SEAT & WHEEL)"
- curl "http://$HOSTNAME/workshop/api/shop/orders" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/workshop/api/shop/products" \
- -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" \
- --data-raw '{"product_id":1,"quantity":1}' \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
-
- curl "http://$HOSTNAME/workshop/api/shop/orders" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/workshop/api/shop/products" \
- -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" \
- --data-raw '{"product_id":2,"quantity":1}' \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
-
- echo "GENERATING TRAFFIC FOR COMMUNITY POSTS API (VIEW RECENT POSTS)"
- for ((x=1; x<=10; x++)); do
- curl "http://$HOSTNAME/community/api/v2/community/posts/recent" \
- -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 \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
- done
-
- echo "GENERATING TRAFFIC FOR ORDERS API (VIEW ALL PAST ORDERS)"
- for ((x=1; x<=10; x++)); do
- curl "http://$HOSTNAME/workshop/api/shop/orders/all" \
- -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 \
- -o /dev/null > /dev/null 2>&1
- done
-
- echo "GENERATING TRAFFIC FOR ORDERS API (VIEW INDIVIDUAL ORDERS)"
- for ((order_id=1; order_id<=5; order_id++)); do
- curl "http://$HOSTNAME/workshop/api/shop/orders/$order_id" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/workshop/api/shop/orders/all" \
- -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" \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: DASHBOARD PAGE request failed."
- fi
- done
-
- echo "GENERATING TRAFFIC FOR PRODUCTS API (VIEW AVAILABLE PRODUCTS)"
- for ((x=1; x<=10; x++)); do
- curl "http://$HOSTNAME/workshop/api/shop/products" \
- -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 \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
- done
-
- echo "GENERATING TRAFFIC FOR VEHICLES API (VIEW VEHICLE DETAILS)"
- for ((x=1; x<=10; x++)); do
- curl "http://$HOSTNAME/identity/api/v2/vehicle/vehicles" \
- -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 \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
- done
-
- echo "----------------------------------------------------------------------------"
-
- done
-
- echo "GENERATING TRAFFIC FOR LOCATIONS API (REFRESH LOCATION)"
- # Loop through each combination
- for ((x=1; x<=10; x++)); do
- for ((i=0; i<${#emails[@]}; i++)); do
- # Generate access token
- access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
- # Get the corresponding UUID
- UUIDS=("7e3633e8-f8e7-47a2-9076-705210dcc213" "b1804463-03be-4c51-88d3-e13b5b9a2331" "50e17ffb-3e81-4f93-8825-fd959310de6c" "2f3fd019-b89e-45dc-9d51-ee0aed14e550")
- UUID=${UUIDS[i]}
-
- curl "http://$HOSTNAME/identity/api/v2/vehicle/$UUID/location" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/identity/api/v2/user/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" \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
-
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
- done
-
- done
- echo "--------------------------------------------------------------------------------------------------------"
-
-
- echo "GENERATING TRAFFIC FOR CONTACT MECHANIC (NEW SERVICE REQUEST) & REPORTS (VIEW REPORTS) API"
- for ((i=0; i<${#emails[@]}; i++)); do
- # Generate access token
- access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
- # Define VINs
- VINS=("8WNFQ29UASO325881" "2QJHA06QPTA452548" "9MZWD50MITK534430" "2QBSC54ZIHY224823")
- VIN=${VINS[i]}
-
- # Execute curl command to view mechanic info
- for ((x=1; x<=25; x++)); do
- curl "http://$HOSTNAME/workshop/api/mechanic/" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/contact-mechanic?VIN=$VIN" \
- -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" \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed."
- fi
-
- done
-
- # Execute curl command to create service request for TRAC_JHN mechanic code
- response_jhn=$(curl "http://$HOSTNAME/workshop/api/merchant/contact_mechanic" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/contact-mechanic?VIN=$VIN" \
- -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" \
- --data-raw "{\"mechanic_code\":\"TRAC_JHN\",\"problem_details\":\"123\",\"vin\":\"$VIN\",\"mechanic_api\":\"http://$HOSTNAME/workshop/api/mechanic/receive_report\",\"repeat_request_if_failed\":false,\"number_of_repeats\":1}" \
- --compressed \
- --insecure)
- # Extract the report link for TRAC_JHN
- report_link_jhn=$(echo "$response_jhn" | jq -r '.response_from_mechanic_api.report_link')
-
-
- # Execute curl command to create service request for TRAC_JME mechanic code
- response_jme=$(curl "http://$HOSTNAME/workshop/api/merchant/contact_mechanic" \
- -H "Accept: */*" \
- -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
- -H "Authorization: Bearer $access_token" \
- -H "Cache-Control: no-cache" \
- -H "Connection: keep-alive" \
- -H "Content-Type: application/json" \
- -H "DNT: 1" \
- -H "Origin: http://$HOSTNAME" \
- -H "Pragma: no-cache" \
- -H "Referer: http://$HOSTNAME/contact-mechanic?VIN=$VIN" \
- -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" \
- --data-raw "{\"mechanic_code\":\"TRAC_JME\",\"problem_details\":\"123\",\"vin\":\"$VIN\",\"mechanic_api\":\"http://$HOSTNAME/workshop/api/mechanic/receive_report\",\"repeat_request_if_failed\":false,\"number_of_repeats\":1}" \
- --compressed \
- --insecure)
- # Extract the report link for TRAC_JME
- report_link_jme=$(echo "$response_jme" | jq -r '.response_from_mechanic_api.report_link')
-
- # Make a curl command for each report link using the corresponding access token
- curl "$report_link_jhn" -H "Authorization: Bearer $access_token" --insecure -sS > /dev/null
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed for TRAC_JHN."
- fi
-
- curl "$report_link_jme" -H "Authorization: Bearer $access_token" --insecure -sS > /dev/null
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed for TRAC_JHN."
- fi
- done
- echo "--------------------------------------------------------------------------------------------------------"
-
- echo "GENERATING TRAFFIC FOR COMMUNITY API (ADD POSTS AND COMMENTS)"
- # Function to make the first curl request
- make_first_request() {
- local access_token=$1
- curl "http://$HOSTNAME/community/api/v2/community/posts" \
- -H 'Accept: */*' \
- -H 'Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6' \
- -H "Authorization: Bearer $access_token" \
- -H 'Cache-Control: no-cache' \
- -H 'Connection: keep-alive' \
- -H 'Content-Type: application/json' \
- -H 'DNT: 1' \
- -H "Origin: http://$HOSTNAME" \
- -H 'Pragma: no-cache' \
- -H "Referer: http://$HOSTNAME/new-post" \
- -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' \
- --data-raw '{"title":"script","content":"script"}' \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
-
-
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed for POSTS."
- fi
- }
-
- # Function to make the second curl request
- make_second_request() {
- local access_token=$1
- local post_id=$2
- curl "http://$HOSTNAME/community/api/v2/community/posts/$post_id/comment" \
- -H 'Accept: */*' \
- -H 'Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6' \
- -H "Authorization: Bearer $access_token" \
- -H 'Cache-Control: no-cache' \
- -H 'Connection: keep-alive' \
- -H 'Content-Type: application/json' \
- -H 'DNT: 1' \
- -H "Origin: http://$HOSTNAME" \
- -H 'Pragma: no-cache' \
- -H "Referer: http://$HOSTNAME/post?post_id=$post_id" \
- -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' \
- --data-raw '{"content":"script"}' \
- --compressed \
- --insecure \
- -o /dev/null > /dev/null 2>&1
-
- # Check the esponse code
- if [ $? -ne 0 ]; then
- echo "Error: Request failed for COMMENTS."
- fi
- }
-
-
- # Loop through the email addresses
- for email in "${emails[@]}"; do
- # Generate access token
- access_token=$(get_access_token "$email" "$COMMON_PASSWORD")
-
- # Make the first request and capture the response
- response=$(make_first_request "$access_token")
-
- # Extract the post ID from the response
- post_id=$(echo "$response" | jq -r '.id')
-
-
- # Make the second request
- make_second_request "$access_token" "$post_id"
- done
|