Wednesday, June 18, 2008

Rapidshare premium download with Wget

#!/bin/bash
# Original author: Mark Sullivan

#########################################################
# I had to modify the script, actually stripped it down,#  
# gotten rid of some unnecessary stuffs. Now it works   #
# perfect on Debian/Ubuntu. -- babil, 18th june'2008.   #
#########################################################
 

RED='\e[1;31m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color
cookie=cookie.txt

if [ -z $3 ] ; then 
 echo
 echo "[*] $0   " 
 echo
 exit 1  
else
 user=$1
 pass=$2
 url=$3
fi


echo -e "${RED}REALURL:${CYAN} $url${NC}"
fileName=`basename $url`
echo -e "${RED}FILENAME: ${CYAN}$fileName${NC}"

## LOGIN and save cookie ##
wget --save-cookies=$cookie -q --post-data="login=$user&password=$pass" https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi -O /dev/null
wget --load-cookies=$cookie $url -O $fileName

## CLEAN UP ##
rm $cookie