Created
July 7, 2017 15:41
-
-
Save xkeshav/2fda262372f8795769777651f368b655 to your computer and use it in GitHub Desktop.
run curl from a file with parameter as post data and variable such as current date, random number
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 | |
# call as `sh curl.sh <uuid> <hostname>` | |
# exmaple sh curl.sh 595e341fd7391071d21ce1b5 20.20.1.73 | |
header="Content-Type: application/json" | |
enc=$(shuf -i 0-1000 -n 1) | |
dec=$(shuf -i 10-600 -n 1) | |
now=$(date +%s%3N) | |
post_data=$(cat <<EOF | |
{ | |
"ip_address": "$2", | |
"baffleShield_id": "$1:CompareServer-0", | |
"num_records_1": $enc, | |
"num_records_2": $dec, | |
"epoch_time": $now | |
} | |
EOF | |
) | |
echo "$post_data" | |
curl -k -X POST -H "$header" -d "$post_data" http://127.0.0.1:8553/whatever/url/$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment