Looking at this page for getting Workspace Properties I am wondering if there is a simple way to get a Users password from an existing SDE connection on the users machine?
Using the code sample from the aforementioned link, something like this:
desc = arcpy.Describe(r"C:data\Connection to state.sde") cp = desc.connectionProperties print("%-12s %s" % (" Password:", cp.password))
For clarification this is for a custom Python Script Tool that creates a new SDE connection as part of the code. Currently I have the user enter their user name and pword in the tool prompt. If I could however have them simply select an existing database connection on their machine and use the creds from that it would be much simpler and less error prone.
I do not think this presents a security risk because it would only have local application. A user would be accessing their own info to automate a process on their personal machine.
There are both Oracle and SQL Servers, I will put logic into the tool that will differentiate between the two.