Information found on this page is for educational purposes only!
Zippyshare prevents direct downloading to show you more advertisement. And who can blame them? After all they offer a free download/upload service used by millions!
Interested in how Zippyshare does this I opened the “web inspector” and looked at the Download button. Hint: Search for “document.getElementById(‘dlbutton’).href”. Below the button you will see something like the following javascript.
document.getElementById('dlbutton').href = "/d/QASIbC2E/" + (718476 % 51245 + 718476 % 913) + "/SOMEFILE.mp3";
if (document.getElementById('fimage')) {
document.getElementById('fimage').href = "/i/QASIbC2E/" + (718476 % 51245 + 718476 % 913) + "/SOMEFILE.mp3";
}
And there you have it! The key to creating a direct link to your download is to solve this simple formula, which is generated randomly every time the website is loaded. In the above example (718476 % 51245 + 718476 % 913). This is of course easily done with python 😀
#!/usr/bin/python
#needed for reading parameters from command line
from sys import argv
#needed for retrieving the website
import requests
#Regular expression operations
import re
#for eval
from math import *
#for using unquote()
from urllib.parse import unquote
#store the website URL in FILE
FILEURL=argv[1]
#store the website in WEBSITE
WEBSITE=requests.get(url = FILEURL)
data = str(WEBSITE.text)
#find the LINK to process
result = re.search('.href = "(.*).mp3', data)
#Check if file exist. If it does then we continue
if result is not None:
#get to the math
baseURL = result.group(0)
outer = re.compile("\((.+)\)")
baseSUM = outer.search(baseURL)
# delete ()
baseSUMnoBrackets = baseSUM.group(0).replace('(','').replace(')', ''))
#do the math
baseMATH=eval((baseSUMnoBrackets))
#URL in parts
part1=re.search('https://(.*).com/', FILEURL)
part1=str((part1.group(0)))
part2=re.search('"/(.*)/"+', baseURL)
part2=str((part2.group(1)))
part3=str(baseMATH)
part4=baseURL.split("+")
part4=part4[3].replace('"', '')
part4=str(part4.replace(' ', ''))
MP3name=unquote(part4)
#create the direct URL
directURL=part1+part2+"/"+part3+part4
print(directURL)
The above quick’n’dirty’ script can be used as follows “zippyshare.py https://URL/” It will give you the direct link to your file. This is only working for one of the protection methods zippyshare uses. From time to time they change the javascript & math. for instance:
var a = 832632%900;
var b = 832632%53;
var c = 8;
if (false) {
c = 9;
var d = 9;
}
var d = 832632%13;
document.getElementById('dlbutton').href = "/d/qKYKRKxr/"+(a * b + c + d)+"/URL.mp3";
if (document.getElementById('fimage')) {
document.getElementById('fimage').href = "/i/qKYKRKxr/"+(a * b + c + d)+"/URL.mp3";
}
Well as you can see this is also a math problem easily solved with python. In my opinion using client side javascript is not enough if you want to prevent direct downloads. My preferred method is using a .htaccess file and php, but that’s a post for another lazy hacker Sunday 🙂 cheers!