Skip to content

Instantly share code, notes, and snippets.

@Ancillas
Last active December 17, 2015 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ancillas/5687150 to your computer and use it in GitHub Desktop.
Save Ancillas/5687150 to your computer and use it in GitHub Desktop.
A small python script to encrypt strings for use in ColdFusion config files. Normally config files, such as neo-datasource.xml, are generated by the ColdFusion admin tool. It encrypts password strings, and puts the encrypted value in the config files. This script will allow you to pre-encrypt strings, which makes administrative control easier wh…
import pyDes
from pyDes import *
import base64
import getpass
import sys
pwd = getpass.getpass('Enter password')
key = getpass.getpass('Enter key (optional)')
if not key:
key = '0yJ!@1$r8p0L@r1$6yJ!@1rj'
k = pyDes.triple_des(key)
d = k.decrypt(base64.decodestring(pwd), padmode=PAD_PKCS5)
print d
import pyDes
from pyDes import *
import base64
import getpass
import sys
pwd = getpass.getpass('Enter password')
key = getpass.getpass('Enter key (optional)')
if not key:
key = '0yJ!@1$r8p0L@r1$6yJ!@1rj'
k = pyDes.triple_des(key)
e = k.encrypt(pwd, padmode=PAD_PKCS5)
print base64.encodestring(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment