Created
February 1, 2018 18:15
-
-
Save thomasp11/fa7b6d1ef80bfbb0d4dcb28e9bce94af to your computer and use it in GitHub Desktop.
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CLOUDSHARK_API will need to be defined somewhere as your CloudShark API token.