This file is indexed.

/usr/share/pyshared/kedpm/password.py is in kedpm 1.0.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright (C) 2003  Andrey Lebedev <andrey@micro.lt>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: password.py,v 1.11 2010/03/09 15:49:26 eg1981 Exp $

""" Password item """

# type constants
TYPE_STRING = 'string'
TYPE_TEXT = 'text'
TYPE_PASSWORD = 'password'

class Password:
    """ Basic class for password structure """
    
    fields_type_info = [
        ('host',     {'title': 'Host', 'type': TYPE_STRING}),
        ('name',     {'title': 'Username', 'type': TYPE_STRING}),
        ('password', {'title': 'Password', 'type': TYPE_PASSWORD}),
    ]

    _fields = {}

    def __init__(self, **kw):
        self._fields = {}
        for key, fieldinfo in self.fields_type_info:
            finfo  = fieldinfo.copy()
            finfo['value'] = kw.get(key, "")
            self._fields[key] = finfo

    def __getitem__(self, key):
        return self._fields[key]['value']

    def __setitem__(self, key, value):
        if self._fields.has_key(key):
            self._fields[key]['value'] = value
        else:
            raise KeyError, "No such field in this password"

    def update(self, info):
        for k in self._fields.keys():
            if info.has_key(k):
                self[k] = info[k]

    def __getattr__(self, name):
        try:
            attr = self[name]
        except KeyError, message:
            raise AttributeError, message
        return attr

    def __setattr__(self, name, value):
        try:
            self[name] = value
        except KeyError, message:
            self.__dict__[name] = value
    
    def getField(self, name):
        '''Returns field descriptor'''
        for key, fieldinfo in self.fields_type_info:
            if key==name:
                return fieldinfo      
        else: 
            raise KeyError, 'No such field defined'
    
    def getFieldTitle(self, name):
        '''Returns title of field "name"'''
        title = ""
        try:
            title = self.getField(name)['title']
        except KeyError:
            pass
        return title

    def getFieldsOfType(self, types = []):
        '''Returns all fields of type listed in types list. If types is empty
        list, return all fields.'''
        res = []
        for key, fieldinfo in self.fields_type_info:
            if fieldinfo['type'] in types or types == []:
                res.append(key)
        return res

    def getSearhableFields(self):
        '''Returns list of fields that can be searched on. Practically this
        means all fields except TYPE_PASSWORD'''
        return self.getFieldsOfType([TYPE_STRING, TYPE_TEXT])

    def getEditPattern(self):
        '''Returns a pattern for parsing EditText'''
      
        #Notes is greedy match and should be in the last position.
        custom_pattern = {'notes' :'''(?P<notes>.*)'''}
        pattern = []

        for key, fieldinfo in self.fields_type_info:
            if custom_pattern.has_key(key):
                pattern.append("%s:\s*%s" % (fieldinfo['title'], custom_pattern.get(key)))
            else:
                pattern.append("%s:\s*(?P<%s>.*?)" % (fieldinfo['title'], key))
     
        return "".join(pattern)
      
    def asText(self):
        'Returns plain text representation of the password'
        astext = ""
        for key, fieldinfo in self.fields_type_info:
            if self[key] == '':
                continue
            astext += "%s: %s\n" % (fieldinfo['title'], self[key])
        return astext
 
    def asEditText(self):
        'Returns plain text representation of the password in an editable and parseable format'
        astext = [] 
        for key, fieldinfo in self.fields_type_info:
            astext.append("%s: %s" % (fieldinfo['title'], self[key]))

        return "\n".join(astext)

    
    def asCSV(self):
        'Returns a one-line, CSV-compatible representation of the password'
        astext = ""
        for key, fieldinfo in self.fields_type_info:
            astext += "\"%s\"," % (self[key])
        astext += "\n"
        return astext