Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## import the icon file from the icopy.py file
- import os
- import string
- import base64
- from itertools import cycle, izip
- import ctypes
- from icopy import icopydata
- key = "QZY0r[CIlVwq1O#SxBt_2eij%b;3$vJK4,FN&TG5PHdzDER+@k7pcm!LX8gufh=y9A^UaMsn-oW6"
- #----------------------------------------------------------------------
- def XOR(message):
- cryptedMessage = ''.join(chr(ord(c)^ord(k)) for c,k in izip(message, cycle(key)))
- return cryptedMessage
- #----------------------------------------------------------------------
- def main(filename):
- """get image,sound from the encrypted picklefile in the img.py file"""
- file2get = filename
- ## check if file in directory. If not return null
- if file2get in icopydata.keys():
- ## get file from the objectstore, decrypt and return it
- strA = base64.b64decode(icopydata[file2get])
- datastr = XOR(strA)
- ## now write it to disk
- with open("dg.ico", "wb") as outfile:
- outfile.write(datastr)
- ## read the file from disk
- image = "dg.ico"
- return image
- if __name__=='__main__':
- main(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement