Skip to content

Instantly share code, notes, and snippets.

@philipsinnott
Created January 20, 2024 12:55
Show Gist options
  • Save philipsinnott/427e155e80f3f03db01d14964e6995b6 to your computer and use it in GitHub Desktop.
Save philipsinnott/427e155e80f3f03db01d14964e6995b6 to your computer and use it in GitHub Desktop.
Adds insertion points to all values of variables, and saves the output to a new file. Useful when you're dealing with big requests that have a lot of variables and wish to perform some type of automated scanning on them in Burp Suite.
#!/bin/bash
# Example usage #
#################
# sample_req.txt == "var1=test&var2=test&var3=test&var4=test"
# chmod +x ./insertion-point-adder.sh
# ./insertion-point-adder.sh sample_req.txt --> "var1=§test§&var2=§test§&var3=§test§&var4=§test§"
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <input_file>"
exit 1
fi
input_file="$1"
output_file="modified_request.txt"
# Check if the input file exists
if [ ! -f "$input_file" ]; then
echo "Error: Input file '$input_file' not found."
exit 1
fi
# Read the original request from the input file
original_request=$(cat "$input_file")
# Add insertion points to the request
modified_request=$(echo "$original_request" | awk -F'&' '{for(i=1;i<=NF;i++){split($i, arr, "="); printf "%s=§%s§", arr[1], arr[2]; if(i<NF) printf "&"}}')
# Save the modified request to the output file
echo "$modified_request" > "$output_file"
echo "Modified request saved to '$output_file'."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment