Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
cloudshark_url="https://www.cloudshark.org"
api_token=${CLOUDSHARK_API}
filename=${1}
echo "curl -s -F file="@${filename}" ${cloudshark_url}/api/v1/${api_token}/upload"
response=$(curl -s -F file="@${filename}" ${cloudshark_url}/api/v1/${api_token}/upload)
json_id=$(echo $response | python -m json.tool | grep id)
if [ "$json_id" != "" ]; then
# find the CloudShark ID for this session
id=`echo $json_id | sed 's/:/ /1' | awk -F" " '{ print $2 }'| sed 's/\"//g'`
# show a URL using the capture session in CloudShark
echo "A new CloudShark session has been created at:"
echo "${cloudshark_url}/captures/$id"
else
echo "Could not upload capture to CloudShark:"
echo $response | python -m json.tool
fi
@thomasp11

This comment has been minimized.

Copy link
Owner Author

commented Apr 1, 2019

CLOUDSHARK_API will need to be defined somewhere as your CloudShark API token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.