Encrypt using Python and Openssl

#!/usr/bin/python

import os
import getpass
import commands

user = passwd = 0

SECRETFILE = os.environ.get('HOME') + '/.secret'

(status,response) = commands.getstatusoutput('which openssl')

if (status == 0):
        print 'openssl ' + response
else:
        print 'openssl not found'
        exit -1

user = getpass.getuser()
fh = open(SECRETFILE, 'r')
passwd = fh.read()
fh.close

print user
print passwd

cmd = response + ' enc -base64 -d -in ' + SECRETFILE
print cmd
(status,response) = commands.getstatusoutput(cmd)
print status
print response

pythondec.txt · Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0