Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/local/bin/python3
- # National Trust Collections zoomable image downloader-decrypter
- # -input parameters-
- # URL of the image page with zoomable content
- url = "http://www.nationaltrustcollections.org.uk/object/593156"
- # Name/path of the file that will be saved to disk
- output_filename = "decrypted.jpg"
- ########################
- from urllib.request import urlopen
- import re
- # RC4, ARC4, ARCFOUR algorithm
- #
- # Copyright (c) 2009 joonis new media
- # Author: Thimo Kraemer <thimo.kraemer@joonis.de>
- # License: GPL
- def rc4crypt(data, key):
- x = 0
- box = list(range(256))
- for i in range(256):
- x = (x + box[i] + ord(key[i % len(key)])) % 256
- box[i], box[x] = box[x], box[i]
- x = 0
- y = 0
- out = bytearray()
- for char in data:
- x = (x + 1) % 256
- y = (y + box[x]) % 256
- box[x], box[y] = box[y], box[x]
- out.append(char ^ box[(box[x] + box[y]) % 256])
- return out
- fileurl = "http://www.nationaltrustcollections.org.uk"
- with urlopen(url) as imgpage:
- fileurl += re.search(r"/EncryptedZoomImage\.ashx\?id_fichier=\d+", imgpage.read().decode()).group(0)
- key = "asdas98as9dasdhas9yd9a8sd8uasu0asdu0uas0asdasd979asyyua98sdyhd08a0889daysdt6cf8dagbcsdahc9gs8ydgb"
- with urlopen(fileurl) as inf, open(output_filename, 'wb') as outf:
- outf.write(rc4crypt(inf.read(), key))
Add Comment
Please, Sign In to add comment