#!/bin/bash # Configuration CLIENT_CODE=[CLIENT CODE] AT_SERVER="$CLIENT_CODE.sc.omtrdc.net" ECID_JSON="ecid.json" COOKIE_JAR="cookies.txt" MBOX_NAME=[MBOX NAME] # # Check needed programs # type jq >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo >&2 "This script requires 'jq'. Install it before proceeding." exit 1 fi type curl >/dev/null 2>&1 if [ $? -ne 0 ] ; then echo >&2 "This script requires 'curl'. Install it before proceeding." exit 1 fi # # Check for ecid.json and cookies.txt # if [ ! -r "$ECID_JSON" ] ; then echo >&2 "Missing ECID. Run ecid.sh before proceeding." exit 1 fi if [ ! -r "$COOKIE_JAR" ] ; then echo >&2 "Missing cookie file. Run ecid.sh before proceeding." exit 1 fi # Generate some parameters # TEST mid=`jq --raw-output '.d_mid' "$ECID_JSON"` region=`jq --raw-output '.dcs_region' "$ECID_JSON"` blob=`jq --raw-output '.d_blob' "$ECID_JSON"` uuid=`awk '/^.demdex.net.*demdex/ { print $7 }' "$COOKIE_JAR"` read -r -d '' POST_DATA </dev/null 2>&1 <<<"$json_string"; then echo >&2 "Failed to parse JSON, or got false/null" exit 1 fi echo $POST_DATA echo $POST_DATA | curl \ --request POST \ --header "User-Agent: Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0" \ --header "X-Forwarded-For: 192.168.0.10" \ --header "Cache-Control: no-cache" \ --header "Content-Type: application/json" \ --cookie "$COOKIE_JAR" --cookie-jar "$COOKIE_JAR" \ --data @- \ --verbose \ "https://$CLIENT_CODE.tt.omtrdc.net/rest/v2/batchmbox/" echo