Skip to content
Snippets Groups Projects

test moat

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by meskio

    Curl based moat test script

    Edited
    test-moat.sh 819 B
    #!/bin/sh
    
    if [ "$MOAT_URL" == "" ]
    then
            MOAT_URL=https://bridges.torproject.org/moat
    fi
    
    TEMPDIR=`mktemp -d`
    
    curl $CURL_OPTIONS -H 'Content-Type: application/vnd.api+json' -X POST $MOAT_URL/fetch > $TEMPDIR/challenge
    cat $TEMPDIR/challenge |jq -r '.data[0].image' |base64 -d > $TEMPDIR/captcha.jpg
    see $TEMPDIR/captcha.jpg &
    
    VERSION=`cat $TEMPDIR/challenge |jq ".data[0].version"`
    CHALLENGE=`cat $TEMPDIR/challenge |jq ".data[0].challenge"`
    echo -n "Captcha solution: "
    read SOLUTION
    curl $CURL_OPTIONS -H 'Content-Type: application/vnd.api+json' -d "{\"data\": [{\"type\": \"moat-solution\", \"id\": \"2\", \"version\": $VERSION, \"transport\": \"obfs4\", \"challenge\": $CHALLENGE, \"qrcode\": \"false\", \"solution\": \"$SOLUTION\"}]}" -X POST --socks5 localhost:9999 $MOAT_URL/check | jq
    
    rm -rf $TEMPDIR
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment