erikg / Revelation
Revelation is a password manager for the GNOME desktop, released under the GNU GPL license. It stores all your accounts and passwords in a single, secure place, and gives you access to it through a user-friendly graphical interface.
| commit 454: | faf1e560d20a |
| parent 453: | a8035f5129f2 |
| branch: | default |
Changed (Δ3.1 KB):
NEWS (1 lines added, 1 lines removed)
src/lib/datahandler/Makefile.am (1 lines added, 0 lines removed)
src/lib/datahandler/__init__.py (3 lines added, 1 lines removed)
src/lib/datahandler/splashid.py (108 lines added, 0 lines removed)
| … | … | @@ -5,6 +5,7 @@ New features: |
5 |
5 |
- translation support |
6 |
6 |
- ported to gtk+ 2.8 and gnome 2.10 |
7 |
7 |
- added LUKS file import/export [John Lenz] |
8 |
- added SplashID CSV file import [Devan Goodwin] |
|
8 |
9 |
- cleaned up preferences dialog |
9 |
10 |
- only show Revelation files by default in open and save dialogs |
10 |
11 |
|
| … | … | @@ -24,7 +25,6 @@ Translations: |
24 |
25 |
- added swedish translation [Daniel Nylander] |
25 |
26 |
|
26 |
27 |
Code changes: |
27 |
- depend on pygtk 2.8 and gnome-python 2.10 |
|
28 |
28 |
- improved build scripts |
29 |
29 |
- generate ChangeLog from subversion log during make dist |
30 |
30 |
- removed gnomemisc module |
Up to file-list src/lib/datahandler/Makefile.am:
| … | … | @@ -14,6 +14,7 @@ datahandler_PYTHON = \ |
14 |
14 |
netrc.py \ |
15 |
15 |
pwsafe.py \ |
16 |
16 |
rvl.py \ |
17 |
splashid.py \ |
|
17 |
18 |
text.py \ |
18 |
19 |
xhtml.py |
19 |
20 |
Up to file-list src/lib/datahandler/__init__.py:
| … | … | @@ -30,6 +30,7 @@ from gpass import GPass04, GPass05 |
30 |
30 |
from netrc import NetRC |
31 |
31 |
from pwsafe import PasswordSafe1, PasswordSafe2, MyPasswordSafe, MyPasswordSafeOld, PasswordGorilla |
32 |
32 |
from rvl import RevelationXML, Revelation, RevelationLUKS |
33 |
from splashid import SplashIDCSV |
|
33 |
34 |
from text import PlainText |
34 |
35 |
from xhtml import XHTML |
35 |
36 |
|
| … | … | @@ -46,6 +47,7 @@ HANDLERS = [ |
46 |
47 |
PlainText, |
47 |
48 |
Revelation, |
48 |
49 |
RevelationLUKS, |
50 |
SplashIDCSV, |
|
49 |
51 |
XHTML, |
50 |
52 |
RevelationXML |
51 |
53 |
] |
| … | … | @@ -80,7 +82,7 @@ def get_export_handlers(): |
80 |
82 |
|
81 |
83 |
|
82 |
84 |
def get_import_handlers(): |
83 |
"Returns a list of handlers which can import" |
|
85 |
"Returns a list of handlers which can import" |
|
84 |
86 |
|
85 |
87 |
handlers = [] |
86 |
88 |
Up to file-list src/lib/datahandler/splashid.py:
1 |
# |
|
2 |
# Revelation 0.4.7 - a password manager for GNOME 2 |
|
3 |
# http://oss.codepoet.no/revelation/ |
|
4 |
# $Id$ |
|
5 |
# |
|
6 |
# Module for importing data from CSV files. |
|
7 |
# |
|
8 |
# Copyright (c) 2006 Devan Goodwin <dgoodwin@dangerouslyinc.com> |
|
9 |
# |
|
10 |
# This program is free software; you can redistribute it and/or |
|
11 |
# modify it under the terms of the GNU General Public License |
|
12 |
# as published by the Free Software Foundation; either version 2 |
|
13 |
# of the License, or (at your option) any later version. |
|
14 |
# |
|
15 |
# This program is distributed in the hope that it will be useful, |
|
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
# GNU General Public License for more details. |
|
19 |
# |
|
20 |
# You should have received a copy of the GNU General Public License |
|
21 |
# along with this program; if not, write to the Free Software |
|
22 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
23 |
# |
|
24 |
||
25 |
import csv, time |
|
26 |
||
27 |
import base |
|
28 |
from revelation import data, entry |
|
29 |
||
30 |
||
31 |
class SplashIDCSV(base.DataHandler): |
|
32 |
""" |
|
33 |
Data handler for CSV files generated by SplashID. |
|
34 |
||
35 |
While SplashID CSV files were used as the basis for this parser, |
|
36 |
by arranging data in the format similar to what SplashID generates |
|
37 |
(i.e. use a spreadsheet and export a CSV with the proper format) |
|
38 |
one should be able to import any CSV file. |
|
39 |
||
40 |
SplashID's CSV data looks like the following: |
|
41 |
||
42 |
Type,Field 1,Field 2,Field 3,Field 4,Field 5,Field 6,Notes,Category |
|
43 |
||
44 |
The mapping to a Revelation generic entry takes place as follows: |
|
45 |
||
46 |
Type: Ignored |
|
47 |
Field 1: Name |
|
48 |
Field 2: Username |
|
49 |
Field 3: Password |
|
50 |
Field 4: Hostname |
|
51 |
Field 5: Added to Description |
|
52 |
Field 6: Added to Description |
|
53 |
Notes: Added to Description |
|
54 |
Category: Folder |
|
55 |
""" |
|
56 |
||
57 |
name = "SplashID CSV" |
|
58 |
importer = True |
|
59 |
exporter = False |
|
60 |
encryption = False |
|
61 |
||
62 |
def import_data(self, input, password): |
|
63 |
""" Import data from a file into the entry store. """ |
|
64 |
||
65 |
# Replace any vertical tabs with spaces, SplashID seems to use |
|
66 |
# these to seperate lines within a Notes field: |
|
67 |
if input.count('\x0b'): |
|
68 |
input = input.replace('\x0b', ' ') |
|
69 |
||
70 |
entrystore = data.EntryStore() |
|
71 |
||
72 |
# Maintain a hash of folder names to folder entries so we |
|
73 |
# can use each category encountered to create a new folder |
|
74 |
# by that name, or use an existing one if we've already |
|
75 |
# created it: |
|
76 |
folders = {} |
|
77 |
||
78 |
for line in input.splitlines(): |
|
79 |
for row in csv.reader([line]): |
|
80 |
||
81 |
# Raise FormatError if we don't have all 9 fields |
|
82 |
if len(row) != 9: |
|
83 |
raise base.FormatError |
|
84 |
||
85 |
# Import the entry |
|
86 |
e = entry.GenericEntry() |
|
87 |
e.name = row[1] |
|
88 |
e.description = " / ".join([ desc.strip() for desc in row[5:7] if desc.strip() != "" ]) |
|
89 |
e.updated = time.time() |
|
90 |
||
91 |
e[entry.UsernameField] = row[2] |
|
92 |
e[entry.PasswordField] = row[3] |
|
93 |
e[entry.HostnameField] = row[4] |
|
94 |
||
95 |
# Create and/or add to folder based on category: |
|
96 |
if folders.has_key(row[8]): |
|
97 |
parent = folders[category] |
|
98 |
||
99 |
else: |
|
100 |
folder = entry.FolderEntry() |
|
101 |
folder.name = category |
|
102 |
parent = entrystore.add_entry(new_folder) |
|
103 |
folders[row[8]] = parent |
|
104 |
||
105 |
# Add the entry |
|
106 |
entrystore.add_entry(e, parent) |
|
107 |
||
108 |
return entrystore |
