Some Oracle products are fairly sweet, let's be honest. One of them is the revamped SQLDeveloper, which has finally caught up (mostly) with MSSQL Management Studio.
One of its best features is the ability to import and export list of connections via XML (right-click on Connections to find the relevant menu). The resulting file is very readable, and hence easily manipulable. The only opaque item is the encrypted password, but it turns out that they are not particularly hardened. This is what you have to do to be able to manipulate them for fun and profit.
- Get Jython, or your favourite choice of JVM dialect that can work with jars. I picked Jython because 1) it's Python! and 2) Oracle ships it with most products, under
db-ca.jar. These can be found in different places depending on your SQLDeveloper version.
oracle.jdevimpl.db.adapter.DatabaseProviderHelper. That class has the two methods you need:
goingOut(i.e. encrypt) and
So here's a complete Jython script for the Windows version of SQLDeveloper:
# set this to the path where you extracted SQLDeveloper SQLDEV_ROOT = r'C:\sqldeveloper' # here's the real stuff import sys from os.path import join sys.path.append(join(SQLDEV_ROOT,r'sqldeveloper\extensions\oracle.datamodeler\lib\ojmisc.jar')) sys.path.append(join(SQLDEV_ROOT,r'sqldeveloper\modules\oracle.adf.model_11.1.1\db-ca.jar')) from oracle.jdevimpl.db.adapter.DatabaseProviderHelper import goingOut as encrypt, comingIn as decrypt if __name__=='__main__': print "Encrypted 'password': " + encrypt('password') print "Decrypted 'password': " + decrypt(encrypt('password'))
Post a Comment