-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathAdflyUrlGrabber.py
37 lines (23 loc) · 907 Bytes
/
AdflyUrlGrabber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Contributor(s): nigella (@nig)
from base64 import b64decode
from urllib.request import urlopen
from sys import argv, exit
__author__ = 'D4Vinci'
def decrypt(code):
''' decrypt the given encrypted code '''
zeros, ones = '', ''
for num, letter in enumerate(code):
if num % 2 == 0: zeros += code[num]
else: ones = code[num] + ones
key = zeros + ones
key = b64decode(key.encode("utf-8"))
return key[2:].decode('utf-8')
if __name__ == '__main__':
''' when script run directly '''
try: url = argv[1]
except: print('usage: python(3) AdflyURLGrabber.py <URL>'); exit()
if "http" not in url: url = "http://" + url
adfly_data = urlopen(url).read()
ysmm = adfly_data.split(b"ysmm = '")[1].split(b"';")[0] # Find encrypted URL code in URL source
decrypted_url = decrypt(ysmm.decode('utf-8')) # Decrypt the URL
print(decrypted_url)