blob: 3bcde6d47cecc8e982fc1087d0d99481f7b8be71 (
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
33
34
35
36
37
38
39
40
41
42
|
# -*- coding: utf-8 -*-
from xml.etree.cElementTree import ElementTree
from foreign.client_handling.lazagne.config.module_info import ModuleInfo
from foreign.client_handling.lazagne.config.constant import constant
import os
class FilezillaServer(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'filezillaserver', 'sysadmin')
def run(self):
path = os.path.join(constant.profile['APPDATA'], u'FileZilla Server')
if os.path.exists(path):
pwd_found = []
file = u'FileZilla Server Interface.xml'
xml_file = os.path.join(path, file)
if os.path.exists(xml_file):
tree = ElementTree(file=xml_file)
root = tree.getroot()
host = port = password = None
for item in root.iter("Item"):
if item.attrib['name'] == 'Last Server Address':
host = item.text
elif item.attrib['name'] == 'Last Server Port':
port = item.text
elif item.attrib['name'] == 'Last Server Password':
password = item.text
# if all((host, port, login)) does not work
if host is not None and port is not None and password is not None:
pwd_found = [{
'Host': host,
'Port': port,
'Password': password,
}]
return pwd_found
|