Advertisement
Gfy

srrup.sh

Gfy
Nov 11th, 2011
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.53 KB | None | 0 0
  1. #!/bin/bash
  2. # Just change the username and password variables and launch with ./srrup.sh <srr file>
  3.  
  4. username="sha0lin"
  5. password=""
  6.  
  7. messages="was added|already exist|is not an srr file|contains illegal characters|is too large to be extracted|is a 0 byte file|is a folder|is too large to be uploaded"
  8.  
  9. cookie_jar="/tmp/srrdb_cookie.$username"
  10.  
  11. curl --cookie-jar "$cookie_jar" \
  12.      --data "login=Login!&password=$password&username=$username" \
  13.      http://www.srrdb.com/login.php > /dev/null 2>&1
  14.  
  15. for file in $@
  16. do
  17.   post_result="$(curl --cookie $cookie_jar --form "file=@$file" --form "upload=Upload" \
  18.    http://www.srrdb.com/upload.php 2> /dev/null | grep -Eo "$messages")"
  19.  
  20.   echo ${file%.srr} $post_result.
  21. done
  22.  
  23. rm -f "$cookie_jar"
  24.  
  25.  
  26. # -- newer version: --------------------
  27. # Just change the username and password variables and launch with ./srrup.sh <srr files>
  28.  
  29. username=""
  30. password=""
  31.  
  32. messages="was added|already exists|is not an srr file|contains illegal characters|is too large to be extracted|is a 0 byte file|is a folder|is too large to be uploaded"
  33.  
  34. cookie_jar="$(mktemp)"
  35.  
  36. curl --cookie-jar "$cookie_jar" \
  37.      --data "login=Login!&password=$password&username=$username" \
  38.      http://www.srrdb.com/login.php > /dev/null 2>&1
  39.  
  40. for file in $@
  41. do
  42.   post_result="$(curl --cookie $cookie_jar --form "file=@$file" --form "upload=Upload" \
  43.    http://www.srrdb.com/upload.php 2> /dev/null | grep -Eo "$messages")"
  44.  
  45.   echo $(tput bold)${file%.srr}$(tput sgr0)  $post_result.
  46. done
  47.  
  48. rm -f "$cookie_jar"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement