#!/bin/bash

function run_curl
{
	curl \
		--insecure \
		--user-agent "AnyConnect Linux 3.1.00495" \
		--header "X-Transcend-Version: 1" \
		--header "X-Aggregate-Auth: 1" \
		--header "X-AnyConnect-Platform: linux" \
		--cookie "sdesktop=$CSD_TOKEN" \
		"$@"
}

set -e

run_curl --data-ascii @- "https://$CSD_HOSTNAME/+CSCOE+/sdesktop/scan.xml?reusebrowser=1" <<-END
endpoint.policy.location="Default";
END

exit 0
