The Road to Elysium

September 16, 2010

Rapidshare Linux Script Revisited

Filed under: Linux — Tags: , , , , , , , , , — jorge @ 12:53

Update: I just added a new variable in the script, DAYS, which specifies how many days the cookie you create is valid for.
Update 2011-09-13: Seems Rapidshare have been tampering with their API, which made the cookie-generating script useless. I basically changed the getaccountdetails_v1 with getaccountdetails, and the script is working fine now. I’ve fixed the script below to reflect this.

The code to get the Rapidshare-cookie in my previous post about this subject, Rapidshare Linux Script, unfortunately doesn’t work anymore. It seems that Rapidshare has moved from using https://ssl.rapidshare.com/premzone.html to https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi, so things just don’t work as they used to. This is for people with a premium account.

However, there’s a solution. First off, log in to your Rapidshare-account, go to Settings and make sure to check the box named Direct downloads, requested files are saved without redirection via RapidShare.

To grab the cookie you need, place the piece of code below in a file, save it, do a chmod +x on it. Just remember to replace MyUserName and MyPassword with your username and password before you run the script:

Note: The script requires curl to be installed.

#!/bin/bash
# Script to get your Rapidshare-cookie, nom nom
# Jorge Enrique Barrera
 
# Variables you can change
USERNAME="MyUserName" # Username to your Rapidshare premium-account
PASSWORD="MyPassword" # Password
COOKIEJAR="/home/jorge/.cookies" # Where the cookies are to be placed
DAYS="30" # The number of days the cookie is valid for
 
 
## Do not change anything below here ##
 
DATA="sub=getaccountdetails&withcookie=1&type=prem&login=$USERNAME&password=$PASSWORD"
COOKIE_STRING=$(curl -s --data "$DATA" "https://api.rapidshare.com/cgi-bin/rsapi.cgi" | grep cookie | cut -c 8-)
COOKIE=".rapidshare.com TRUE / FALSE $(($(date +%s)+24*60*60*$DAYS)) enc $COOKIE_STRING"
 
if [ ! -d $COOKIEJAR ]; then
        echo "Creating the directory $COOKIEJAR."
        mkdir $COOKIEJAR
        echo "Done."
fi
 
echo "$COOKIE" | tr ' ' '\t' > $COOKIEJAR/rapidshare

Now that the cookie is present, you can proceed by downloading the files you want. Which way you do that, is up to you.

Either way I will paste two scripts, one with wget and the other one with aria2, and you can then make your pick. Just place the URL of the files you want to download in /home/jorge/Downloads/.url, one in each line:

wget

#!/bin/bash
LIST="/home/jorge/Downloads/.url"
cd ~/Downloads
for url in `cat $LIST`
do
    wget -c --load-cookies /home/jorge/.cookies/rapidshare $url
done

Save this file as wrsd.sh and make it executable by doing a:

$ chmod +x wrsd.sh

aria2

#!/bin/bash
cd ~/Downloads
aria2c -j 5 -c --load-cookies=/home/jorge/.cookies/rapidshare -i /home/jorge/Downloads/.url

Enjoy. :)

September 15, 2010

Python password generator

Filed under: Snippets — Tags: , , — jorge @ 17:07
#!/usr/bin/env python
# Filename: passgen.py
 
import random, string
 
mystr = string.ascii_letters+string.digits
random_string = []
 
while len(random_string) <= 8:
    random_string.append(random.choice(mystr))
print "".join(random_string)

September 14, 2010

Acer Aspire One USB Rescue Image

Filed under: Linux — Tags: , , , , , , , — jorge @ 09:10

A lot of people have been asking about where to find a rescue USB image for the Acer Aspire One. A long time ago someone with the nick gouki volunteered to host the file on a private server, but unfortunately, this is not so anymore.

I have placed the file on a new server, so you can now find it at http://jorge.fbarr.net/files/aa1_usb_recovery_image.gz. Right on the link and select Save link as to download it.

As for instructions on how to use it, I’ll repost a snippet of what I’ve written previously in the article Acer Aspire One Tips and Tricks:

I had to use an external USB drive for this, as I don’t have a USB-pen that’s above 125MB, but it works just the same. Besides the Acer One Aspire, I’ve another machine with Fedora 9 on it. Once the external drive was plugged in, this is what dmesg came up with:

usb 2-2.1: New USB device found, idVendor=1058, idProduct=0702
usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-2.1: Product: External HDD
usb 2-2.1: Manufacturer: Western Digital
usb 2-2.1: SerialNumber: 575845363037433636303733
usb-storage: device found at 14
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 16:0:0:0: Direct-Access     WD       1200BEVExternal  1.02 PQ: 0 ANSI: 0
sd 16:0:0:0: [sdb] 234441648 512-byte hardware sectors (120034 MB)
sd 16:0:0:0: [sdb] Write Protect is off
sd 16:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 16:0:0:0: [sdb] Assuming drive cache: write through
sd 16:0:0:0: [sdb] 234441648 512-byte hardware sectors (120034 MB)
sd 16:0:0:0: [sdb] Write Protect is off
sd 16:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 16:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 16:0:0:0: [sdb] Attached SCSI disk
sd 16:0:0:0: Attached scsi generic sg2 type 0

So now we know that the drive has been assigned /dev/sdb. Let’s make the recovery usb drive then.

WARNING: This next command will end up erasing your WHOLE drive, so be cautious when you type it. As root, type:

# zcat aa1_usb_recovery_image.gz > /dev/sdb

Notice that it’s /dev/sdb and NOT /dev/sdb1, as we’re overwriting the whole disk, and not just a partition of the disk.

That did the trick for me. Once the command was completed, remount the external drive and you’ll see that the new contents is there. Unmount it again, plug it into your Acer Aspire One, boot the machine, and press F12 during boot to select the USB-pen/external harddrive as the device to boot. You should be on your way towards recovery. :)

If someone happens to know how to do this in Windows, please give me a shout so that I can add it to this post. :)

A big thanks to Mithrandir for providing the file. :)

September 8, 2010

Spotify for Linux rpm

Filed under: Linux — Tags: , , , , — jorge @ 11:00

I’ve taken the liberty of converting the “Spotify for Linux”-files located at http://www.spotify.com/no/download/previews/ from .deb to .rpm. For now it can only be used if you have a Premium account.

To install it on Fedora 13, do the following:

su -
rpm --nodeps -Uvh http://jorge.fbarr.net/files/spotify-client-gnome-support.noarch.rpm http://jorge.fbarr.net/files/spotify-client-qt.i386.rpm

And that’s it. Now you can run Spotify as a Linux-application instead of through Wine. :)

Powered by WordPress