#!/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