Skip to content

Instantly share code, notes, and snippets.

@FollowMeDown
Forked from bmaddy/csd-responder-exec.sh
Created January 9, 2020 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FollowMeDown/e5bfc7e1e0e3c8de1172e7a9d58073f5 to your computer and use it in GitHub Desktop.
Save FollowMeDown/e5bfc7e1e0e3c8de1172e7a9d58073f5 to your computer and use it in GitHub Desktop.
Connecting to Cisco's AnyConnect SSL VPN on MacOS (bypassing the EOL'd Cisco Secure Desktop)
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/csd-responder.sh "$@" 2>&1 | sed -e "s/^/ [csd] /"
#!/bin/bash
echo "$0""$@"
env | grep CSD | sort | sed -e "s/^/ENV: /"
# location is usually "Default"
location=$(wget -O - -q "https://$CSD_HOSTNAME/CACHE/sdesktop/data.xml?reusebrowser=1" | grep 'location name=' | head -1 | sed -e 's/.*"\(.*\)".*/\1/')
POST_DATA=$(mktemp)
CURL_CMD=$(mktemp)
agent="AnyConnect Linux"
plat=linux-x86_64
ver=4.2.03013
cat > $POST_DATA <<-END
endpoint.policy.location="Default";
endpoint.enforce="success";
endpoint.fw["IPTablesFW"]={};
endpoint.fw["IPTablesFW"].exists="true";
endpoint.fw["IPTablesFW"].enabled="ok";
endpoint.as["ClamAS"]={};
endpoint.as["ClamAS"].exists="true";
endpoint.as["ClamAS"].activescan="ok";
endpoint.av["ClamAV"]={};
endpoint.av["ClamAV"].exists="true";
endpoint.av["ClamAV"].activescan="ok";
END
cat > $CURL_CMD <<-END
curl \\
--insecure \\
--user-agent "$agent $ver" \\
--header "X-Transcend-Version: 1" \\
--header "X-Aggregate-Auth: 1" \\
--header "X-AnyConnect-Platform: $plat" \\
--cookie "sdesktop=$CSD_TOKEN" \\
--data-ascii $POST_DATA \\
"https://$CSD_HOSTNAME/+CSCOE+/sdesktop/scan.xml?reusebrowser=1"
END
cat $CURL_CMD | sed -e "s/^/CURL: /"
cat $POST_DATA | sed -e "s/^/POST: /"
. $CURL_CMD
echo "curl exited with $?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment