Skip to content

Instantly share code, notes, and snippets.

@EvgeniGordeev
Created February 7, 2025 16:55
Show Gist options
  • Save EvgeniGordeev/ba93887c08f997b182ca9998a53826be to your computer and use it in GitHub Desktop.
Save EvgeniGordeev/ba93887c08f997b182ca9998a53826be to your computer and use it in GitHub Desktop.
Reveal DataGrip passwords saved in Keychain
import re
import subprocess
if __name__ == '__main__':
# located in project folder .idea/dataSources.xml
with open('dataSources.xml', 'r') as f:
data = f.read()
data_sources = sorted(re.findall(r".*data-source.*name=\"(.*?)\".*uuid=\"(.*?)\".*", data))
for name, uuid in data_sources:
command = f'security find-generic-password -l "IntelliJ Platform DB — {uuid}" -w'
result = subprocess.run(command, shell=True, capture_output=True, text=True)
print(f"{name}={result.stdout.strip()}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment