Skip to content

Instantly share code, notes, and snippets.

@miawgogo
Created July 7, 2015 18:59
Show Gist options
  • Save miawgogo/61ce47578b80bb794699 to your computer and use it in GitHub Desktop.
Save miawgogo/61ce47578b80bb794699 to your computer and use it in GitHub Desktop.
what i mannaged to do with a lack of sleep
import csv,getpass
from Crypto.Cipher import AES
global ecsv
global uecsv
global passdict
global pwddb
global obj
pwddb=getpass("Enter Database Password:")
IV = 16 * '\x00' #this is a temporey IV until i can work out a good way to generate one
obj = AES.new(pwddb, AES.MODE_CBC, IV=IV)
def csvdecrypt(filecontent):
return obj.decrypt(filecontent)
def csv2dict(csvtext):
return csv.DictReader(csvtext)
def getpassword(filename):
ecsv=open(filename)
uecsv=csvdecrypt
passdict=csv2dict(uecsv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment