Tuesday, October 09, 2007

Rapidshare hack for Linux

As it turns out it's unbelievably easy to overcome annoying time delay between downloads of the free Rapidshare account. And it's even easier if you happen to run Linux.

Rapidshare "remembers" the IP address you used to download, so all you have to do is to change it between subsequent downloads by restarting DHCP client. In order to ensure that you will not get the same IP address (Linux DHCP client tries to get the same IP by first issuing the DHCP REQUEST and only if it fails - DHCP DISCOVER; and most DHCP servers will try to lease the same IP address for the same MAC address) you have to change... right, the MAC address. And, as I mentioned above, this is yet another example of Linux being much more user-oriented OS than the other one - changing MAC address on Linux is a breeze.

#!/bin/sh
ifdown eth0
let "rnum = $RANDOM % 255"
d=`printf "%02X\n" $rnum`
ifconfig eth0 hw ether 00:0F:EA:37:9F:$d
rm /var/lib/dhclient/dhclient-eth0.leases
ifup eth0


Remember to change the MAC address of the correct interface, i.e. the one on which you get the normal (routable) IP address.

Labels: , , , ,

16 Comments:

Anonymous Anonymous said...

This comment has been removed by a blog administrator.

7:36 AM  
Blogger  said...

Hi Sasha,

Thanks for the script, but when i'm trying to run in terminal have the next info:

linuzxoch:/bin # rapishare.sh
Network interface is managed from NetworkManager
NetworkManager cannot be advised to take down an interface.
Set up another interface instead.
rm: cannot remove `/var/lib/dhclient/dhclient-eth0.leases': No such file or directory
Network interface is managed from NetworkManager
NetworkManager will be advised to set up eth0
but it cannot be assured from here.


Any help?

This is my email: zxoch.m@gmail.com.
Ḅest regards.
Zoch.

6:40 AM  
Blogger Demiurg said...

My script assumes that the interface in question is not managed by NetworkManager and was not tested on Ubuntu, so it will require some tweaking.

Generally, you will have to shut down NetworkManager, change MAC address and than bring it up. The following commands (not tested) would probably do this:

/etc/init.d/NetworkManager stop
ifdown eth0
let "rnum = $RANDOM % 255"
d=`printf "%02X\n" $rnum`
ifconfig eth0 hw ether 00:0F:EA:37:9F:$d
/etc/init.d/NetworkManager start

11:17 AM  
Blogger zohaibar said...

This comment has been removed by a blog administrator.

8:20 PM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

2:07 PM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

5:56 AM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

7:53 AM  
Blogger Unknown said...

It's seems like a very nice script, although when I run it on my Mandriva Linux it returns:

[guyl@localhost ~]$ sh ./Desktop/rapidshare.sh
./Desktop/rapidshare.sh: line 2: ifdown: command not found
./Desktop/rapidshare.sh: line 5: ifconfig: command not found
rm: cannot remove `/var/lib/dhclient/dhclient-eth0.leases': No such file or directory
./Desktop/rapidshare.sh: line 7: ifup: command not found

Help?

9:32 AM  
Blogger Demiurg said...

Well... I thought it was obvious that you have to be root in order to do this

9:43 AM  
Blogger Unknown said...

Well, thanks for the comment but I already got that working out. But although it seemed like it changed my IP address, RapidShare still detects my old one! And I do clean the cookies and stop the download before I try again. I'm guessing that's because it read the firewall's IP and not my own computer's? Well, anyway, if you could help, that will be very kind.

11:31 AM  
Blogger Demiurg said...

Firewall !!?? I guess you mean router ? Are you behind NAT ? Is your IP in the 10.x.x.x or 192.168.x.x subnet ?

If it is, than the script should be executed on the router itself (if you have shell access to it), i.e. the MAC address of the interface that receives internet routable address should be changed.

11:36 AM  
Blogger Unknown said...

Well, I don't understand that much about these things, so I'm sorry about the mistake. My IP is the 192.168.x.x, and how do I access my router? I don't think it's connected to any computer.

12:00 PM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

7:10 AM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

6:59 AM  
Anonymous Anonymous said...

This comment has been removed by a blog administrator.

8:26 AM  
Anonymous Anonymous said...

Since rapidshare checks against your "public" IP, eg the one your ISP assigns you, changing your "local" IP won't help you much.
To renew your IP if connected through a router (as commonly the case), log into the router and disconnect/reconnect the internet/WAN. Router address can be found by issuing the command "route" in a terminal, than copy over the IP next to "default" into your web-browser.
If you use pppoe, a simple disconnect-connect should do the same.
Above works the same on windows.
Cheers,
keedug

11:48 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home