Last active
March 31, 2024 14:44
-
-
Save yosignals/19b87c1fc72a4b3fcbc46d1856560514 to your computer and use it in GitHub Desktop.
Surgeon | DataBouncing Script for specific web requests, POST, GET, PUT, Whatever, where ever the hostname exists that get's processed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to check if a command exists | |
command_exists() { | |
type "$1" &> /dev/null | |
} | |
# Preflight check for necessary commands (curl and sed) | |
if ! command_exists curl; then | |
echo "Error: curl is not installed. Please install curl and try again." | |
exit 1 | |
fi | |
if ! command_exists sed; then | |
echo "Error: sed is not installed. Please install sed and try again." | |
exit 1 | |
fi | |
# Check if sufficient arguments are provided | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 'curl_command_template' 'file_path'" | |
exit 1 | |
fi | |
# First argument is the cURL command template | |
curl_command_template=$1 | |
# Second argument is the path to the file | |
file_path=$2 | |
# Check if the file exists | |
if [ ! -f "$file_path" ]; then | |
echo "Error: File not found at $file_path" | |
exit 1 | |
fi | |
# Reading each line from the file | |
while IFS= read -r line | |
do | |
# Replace the placeholder with the current line | |
modified_curl_command=$(echo "$curl_command_template" | sed "s/DATA_BOUNCE_HERE/$line/") | |
# Execute the cURL command | |
eval "$modified_curl_command" | |
# Optional: Output the status or any response | |
echo "Processed line: $line" | |
done < "$file_path" | |
echo "All lines have been processed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment