Skip to content

Instantly share code, notes, and snippets.

@bodqhrohro
Last active September 1, 2017 12:07
Show Gist options
  • Select an option

  • Save bodqhrohro/634b3d10ff60fef4ac3f to your computer and use it in GitHub Desktop.

Select an option

Save bodqhrohro/634b3d10ff60fef4ac3f to your computer and use it in GitHub Desktop.
pic4a.ru uploader
#!/bin/bash
#Requirements: curl, jq, sed, grep
#Usage: pic4a <filename>
#token=`curl -s https://pic4a.ru/|grep csrfmiddlewaretoken|sed "s/.*value='\([^']*\)'.*/\1/"`
token=`curl -s https://pic4a.ru/ -c - -o /dev/null|grep csrf|sed 's/.*csrftoken\s\+\(.*\)/\1/'`
curl -# \
-F "csrfmiddlewaretoken=$token" \
-b "csrftoken=$token" \
-F "files[]=@$1" \
-H 'Accept-Encoding: gzip' \
-H 'Origin: https://pic4a.ru' \
-H 'Referer: https://pic4a.ru' \
https://pic4a.ru/upload/ \
|jq -r '.files[0].name?'|sed 's!^!https://pic4a.ru/!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment