riscritto unshorten vcrypt (test)
This commit is contained in:
+28
-23
@@ -468,32 +468,37 @@ class UnshortenIt(object):
|
|||||||
return uri, str(e)
|
return uri, str(e)
|
||||||
|
|
||||||
def _unshorten_vcrypt(self, uri):
|
def _unshorten_vcrypt(self, uri):
|
||||||
try:
|
r = None
|
||||||
req = httptools.downloadpage(uri, timeout=self._timeout, follow_redirects=False)
|
import base64
|
||||||
idata = req.data
|
from Crypto.Cipher import AES
|
||||||
from core import scrapertools
|
def decrypt(str):
|
||||||
|
str = str.replace("_ppl_", "+").replace("_eqq_", "=").replace("_sll_", "/")
|
||||||
|
iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||||
|
key = "naphajU2usWUswec"
|
||||||
|
crypt_object = AES.new(key=key, mode=AES.MODE_CBC, IV=iv)
|
||||||
|
|
||||||
patron = r"document.cookie\s=\s.*?'(.*)'"
|
decoded = base64.b64decode(str)
|
||||||
match_str = re.compile(patron, re.MULTILINE).findall(idata)[0]
|
return crypt_object.decrypt(decoded).replace('\0', '')
|
||||||
|
if '/shield' in uri:
|
||||||
|
uri = decrypt(uri.split('/')[-1])
|
||||||
|
else:
|
||||||
|
import datetime, hashlib
|
||||||
|
ip = urllib.urlopen('http://ip.42.pl/raw').read()
|
||||||
|
day = datetime.date.today().strftime('%Y%m%d')
|
||||||
|
headers = {
|
||||||
|
"Cookie": hashlib.md5(ip+day).hexdigest() + "=1"
|
||||||
|
}
|
||||||
|
uri = uri.replace('sb/','sb1/')
|
||||||
|
uri = uri.replace('akv/','akv1/')
|
||||||
|
uri = uri.replace('wss/','wss1/')
|
||||||
|
uri = uri.replace('wsd/','wsd1/')
|
||||||
|
r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False)
|
||||||
|
uri = r.headers['location']
|
||||||
|
|
||||||
patron = r';URL=([^\"]+)\">'
|
if "4snip" in uri:
|
||||||
dest = scrapertools.find_single_match(idata, patron)
|
uri = decrypt(uri)
|
||||||
http_headers = {"Cookie": match_str}
|
|
||||||
r = httptools.downloadpage(dest, post=' ', headers=http_headers)
|
|
||||||
uri = r.url
|
|
||||||
|
|
||||||
if "4snip" in uri:
|
return uri, r.code if r else 200
|
||||||
desturl = uri.replace("/out/", "/outlink/")
|
|
||||||
import os
|
|
||||||
par = os.path.basename(desturl)
|
|
||||||
post = 'url=' + par
|
|
||||||
r = httptools.downloadpage(desturl, post=post)
|
|
||||||
uri = r.url
|
|
||||||
|
|
||||||
return uri, r.code
|
|
||||||
|
|
||||||
except Exception, e:
|
|
||||||
return uri, str(e)
|
|
||||||
|
|
||||||
def unwrap_30x_only(uri, timeout=10):
|
def unwrap_30x_only(uri, timeout=10):
|
||||||
unshortener = UnshortenIt()
|
unshortener = UnshortenIt()
|
||||||
|
|||||||
Reference in New Issue
Block a user