Advertisement
rakeshr

gdrivebakcup

Apr 29th, 2014
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.19 KB | None | 0 0
  1.  
  2. file="$1"
  3. browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
  4.  
  5. username=`cat credits.ini | grep username |cut -d \= -f 2`
  6. password=`cat credits.ini | grep password |cut -d \= -f 2`
  7.  
  8. accountype="GOOGLE" #gooApps = HOSTED , gmail=GOOGLE
  9. mime_type=`file -b --mime-type $file`
  10.  
  11. msg=$(/usr/bin/curl \
  12. -v \
  13. --data-urlencode Email=$username \
  14. --data-urlencode Passwd=$password \
  15. -d accountType=$accountype \
  16. -d service=writely \
  17. -d source=cURL \
  18. "https://www.google.com/accounts/ClientLogin")
  19.  
  20. token=`echo "$msg" | grep Auth | cut -d \= -f 2`
  21.  
  22. uploadlink=`/usr/bin/curl \
  23. -Sv \
  24. -k \
  25. --request POST \
  26. -H "Content-Length: 0" \
  27. -H "Authorization: GoogleLogin auth=${token}" \
  28. -H "GData-Version: 3.0" \
  29. -H "Content-Type: $mime_type" \
  30. -H "Slug: $file" \
  31. "https://docs.google.com/feeds/upload/create-session/default/private/full/folder:$folderid/contents?convert=false" \
  32. -D /dev/stdout | grep "Location:" | sed s/"Location: "//`
  33.  
  34. /usr/bin/curl \
  35. -Sv \
  36. -k \
  37. --request POST \
  38. --data-binary "@$file" \
  39. -H "Authorization: GoogleLogin auth=${token}" \
  40. -H "GData-Version: 3.0" \
  41. -H "Content-Type: $mime_type" \
  42. -H "Slug: $file" "$uploadlink" \
  43. -D /dev/stdout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement